Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Nixxon on Wed 18/06/2003 18:30:25

Title: New Room when object finishes animating
Post by: Nixxon on Wed 18/06/2003 18:30:25
Greetings :D
Simply put, how would i script a new room to load once my object has finished it's animation view/loop?

heres the object and animation in question -
SetObjectView(1,22);
AnimateObject(1,0,3,0);

thanks :D

EDIT -
Tried this to no avail
while (IsObjectAnimating(1)==0) NewRoom(9);
Title: Re:New Room when object finishes animating
Post by: Scummbuddy on Wed 18/06/2003 18:48:43
Why not put in a wait command with as many game cycles that the animation takes to go after the animate call, and then do newroom?
Title: Re:New Room when object finishes animating
Post by: Archangel (aka SoupDragon) on Wed 18/06/2003 20:51:34
The code should read this:

SetObjectView(1,22);
AnimateObject(1,0,3,0);
while (IsObjectAnimating(1)) {
Wait(1);
}
NewRoom(9);
Title: Re:New Room when object finishes animating
Post by: TerranRich on Wed 18/06/2003 23:38:11
Quote from: Archangel on Wed 18/06/2003 20:51:34
The code should read this:

SetObjectView(1,22);
AnimateObject(1,0,3,0);
while (IsObjectAnimating(1)) {
Wait(1);
}
NewRoom(9);

Yes, because other wise the game would be trying to change rooms every single time it checks to see if the object is animating, which is usually 40 times per second, unless changed.
Title: Re:New Room when object finishes animating
Post by: Nixxon on Thu 19/06/2003 02:40:21
Thanks people,
I often avoid using wait, sinse my comp is a mediocre chunk of shyte Wait(40) which is equal to 1 second can often be around 6 seconds, hard to keep things in sync. Anyways ill try the code, Cheers ;)

- Yup all workies :D thanks again
Title: Re:New Room when object finishes animating
Post by: Timosity on Thu 19/06/2003 05:49:42
The other code may work but you were close with your original one

This is how it works

while (IsObjectAnimating(1)==1) Wait(1);
NewRoom(9);

it will wait till the animation completes and then go to the new room