Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: AndersM on Thu 21/10/2004 17:15:24

Title: Moves character too early (SOLVED)
Post by: AndersM on Thu 21/10/2004 17:15:24
Here's my problem:

When interacting with the door, The character (JOHN)
is supposed to go to the door, the door door will open,
John will go trough it, it will close behind him,
and then the character will go to the other room. This
doesn't hapen. He goes to the other room directly. Help?

function object0_b() {
  // script for object0: Interact object
MoveCharacter(JOHN,45,119);
AnimateObject(0,0,0,0);
RestoreWalkableArea(2); 
MoveCharacter(JOHN,31,120);
AnimateObject(0,1,0,0);
NewRoomEx(3,100,120);
}
Title: Re: Moves character too early
Post by: Barbarian on Thu 21/10/2004 17:41:31
Where you have "MoveCharacter(JOHN,45,119);" and "MoveCharacter(JOHN,31,120);"Ã,  in your script, you should consider replacing it with:

"MoveCharacterBlocking(JOHN,45,119,0);" and
"MoveCharacterBlocking(JOHN,31,120,0);"


The MoveCharacterBlocking command will move the character to location (X,Y), waiting until they arrive there before returning to the script.

Otherwise, just using the MoveCharacter command, it will continue to process the next command and so on before completing the movement.

Title: Re: Moves character too early
Post by: AndersM on Thu 21/10/2004 17:56:52
That did it. Thanx.