Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Akumayo on Fri 19/03/2004 09:26:24

Title: Call me stupid but....
Post by: Akumayo on Fri 19/03/2004 09:26:24
I probably completely missed this in the manual and forums but I CAN'T FIND IT!!!  How on Earth can you make a character (not the player character) walk back and forth WITHOUT HALTING GAMEPLAY???  I wan't to do this like, there is a guy who is walking back and forth on top of a button, you have to get to the button and not touch him.  How can I do this, hmm........ I tried everything, hotspots, objects, Direct, Straight, Path, Blocking, Colliding, I just can't figure the simple thing out, PLEASE HELP!!!
Title: Re:Call me stupid but....
Post by: Gilbert on Fri 19/03/2004 09:48:12
Well...

1. Please calm down.
2. Use descriptive subject
3. This thread is more suitable for the beginner's tech forum
4. Try to do something like this (not checked) in repeated_execute event of that room (suppose you want character BUM to walk to and fro the coordinates (50,100) and (200,100)), provided you first place him on one of the sides:

if ((character[BUM].x==50)&&(character[BUM].y==100)) { //if he reaches the left coordinates
 MoveCharacter(BUM,200,100);//Move him to the right
} else if ((character[BUM].x==200)&&(character[BUM].y==100)) { //if he reaches the right coordinates
 MoveCharacter(BUM,50,100);//Move him to the left
}


Title: Re:Call me stupid but....
Post by: Akumayo on Fri 19/03/2004 10:25:54
MoveCharacter functions cause you to have to wait while BUM moves, I need him to move while I am moving as well!!!

Quote: "WITHOUT HALTING GAMEPLAY"  

remember...
Title: Re:Call me stupid but....
Post by: Darth Mandarb on Fri 19/03/2004 11:08:10
Look up MoveCharacterBlocking ...

I can't remember the exact syntax, but it's something like this:
MoveCharacterBlocking(CHARID,X,Y,VAL);
CHARID,X, and Y are self explanatory
VAL is either 0 or 1, 0 for non-pause, 1 for pausing the game.

I believe that's how it works, but look it up just in case :)

~ d
Title: Re:Call me stupid but....
Post by: a-v-o on Fri 19/03/2004 15:15:14
@Darth Mandarb:
MoveCharacterBlocking is the blocking version of MoveCharacter. VAL is the "direct" Parameter which is used to control wether to ignore walkable areas or not.

@Akumayo:
MoveCharacter is non-blocking. I'd suggest you first try out a solution you were given, unless you really know that it isn't working.

Besides Gilbot's solution you can use a combination of MoveCharacter and MoveCharacterPath in repeatedly_execute:

if (character [BLUM].x <= 50)
{
 MoveCharacter (BLUM, 200, 100);
 MoveCharacterPath (BLUM, 50, 100);
}
Title: Re:Call me stupid but....
Post by: Pumaman on Fri 19/03/2004 17:31:08
To be on the safe side, I'd adjust it slightly:

if (character[BLUM].walking == 0)
{
MoveCharacter (BLUM, 200, 100);
MoveCharacterPath (BLUM, 50, 100);
}

otherwise it's possible that while at X=50, the move would keep getting restarted and he'd not move.

One point this thread does bring up is the confusing naming between MoveCharacter, MoveCharacterBlocking and MoveCharacterDirect. I may well merge all three into a single command at some point to make things clearer.
Title: Re:Call me stupid but....
Post by: Akumayo on Fri 19/03/2004 21:20:04
Thanks guys, Punaman, I'll try yours, I really hope that someday I willl understand all of this... AND THAT MOVING CHARACTERS WILL BE EASY!!!
Title: Re:Call me stupid but....
Post by: DoorKnobHandle on Sat 20/03/2004 14:29:24
QuoteMOVING CHARACTERS WILL BE EASY

l0l...

*no comment*