Page 1 of 1

Running a single animation cycle

PostPosted: Sat Dec 22, 2012 5:18 am
by bamby1983
I have a scenario where an animation needs to run just once and then stop (basically no looping endlessly). In my present case, it is a door or a window sliding or swinging open or shut. I noticed an animation stop event in game editor so here is what I came up with as a possible solution:

1) The change animation function is triggered by an event and plays in the forward direction when the door or window is opened
2) The animation stop event is added to that object and it triggers another change animation function that shows the animation state as "stopped" so that the animation stops once the door or window is completely open
3) When this open door or window needs to be shut, the event triggers a change animation function that plays the animation in reverse
4) The animation stop event stops the animation once it has completed, thereby freezing the door or window shut

I'm not sure if this is the standard way to do this, so I'd just like to clarify whether this is how it needs to be done or whether there is a better suited way to doing this.

Re: Running a single animation cycle

PostPosted: Sat Dec 22, 2012 9:49 am
by skydereign
I wouldn't say it is the most common way to do it, I think a lot of users would use an open animation, and a close animation. But it is a good and valid way, and saves an animation. One thing though, it sounds like you would be using ChangeAnimation to rechange the states. If so, you should really use ChangeAnimationDirection, as it doesn't actually change the current frame.

Re: Running a single animation cycle

PostPosted: Sat Dec 22, 2012 8:51 pm
by bamby1983
Thanks. Would you say that the method I proposed to stop the animation (using the animation stop event) is the right way to do this? If not, could you please suggest a better way?

Re: Running a single animation cycle

PostPosted: Sun Dec 23, 2012 1:36 am
by skydereign
bamby1983 wrote:Thanks. Would you say that the method I proposed to stop the animation (using the animation stop event) is the right way to do this? If not, could you please suggest a better way?

From what you told me, yeah, it is a good way (again assuming you mean ChangeAnimationDirection instead of ChangeAnimation). It is a pretty good setup, since setting the animation direction to stopped at the animation finish will work properly in both ways (stop on the last, and stop on the first, frame depending on the direction).

Re: Running a single animation cycle

PostPosted: Sun Dec 23, 2012 4:19 pm
by bamby1983
Thank you.