Running a single animation cycle

Non-platform specific questions.

Running a single animation cycle

Postby bamby1983 » Sat Dec 22, 2012 5:18 am

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.
bamby1983
 
Posts: 112
Joined: Tue Jul 31, 2012 11:36 pm
Score: 8 Give a positive score

Re: Running a single animation cycle

Postby skydereign » Sat Dec 22, 2012 9:49 am

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Running a single animation cycle

Postby bamby1983 » Sat Dec 22, 2012 8:51 pm

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?
bamby1983
 
Posts: 112
Joined: Tue Jul 31, 2012 11:36 pm
Score: 8 Give a positive score

Re: Running a single animation cycle

Postby skydereign » Sun Dec 23, 2012 1:36 am

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).
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Running a single animation cycle

Postby bamby1983 » Sun Dec 23, 2012 4:19 pm

Thank you.
bamby1983
 
Posts: 112
Joined: Tue Jul 31, 2012 11:36 pm
Score: 8 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron