Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: selmiak on Sun 03/03/2013 19:13:47

Title: set startframe for animation
Post by: selmiak on Sun 03/03/2013 19:13:47
so I have this animating object and i want to dynamically rewind it, so I get the current frame with oAnimation.Frame, and then want to rewind the animation from that frame on like
Code (AGS) Select
oAnimation.Animate(1, 4, eOnce, eNoBlock, eBackwards );
but start it at the current oAnimation.Frame where the animation is interrupted. oAnimation.SetView(1,1,oAnimation.Frame) doesn't help.
How do I do this with AGS?
Title: Re: set startframe for animation
Post by: Khris on Tue 05/03/2013 01:01:28
I'm pretty sure that the Animate command always starts at either end of the loop, so you have to do it manually.
Just use a timer and when it runs out, advance the frame and reset the timer.
Title: Re: set startframe for animation
Post by: Scavenger on Tue 05/03/2013 01:48:06
Depending on how many frames you have for your animation, you could just make several loops in your object view, each with successively more frames, and when you get the frame number, you animate the loop that has that frame as the last frame. Like, in Loop 0, put the entire animation, in Loop 1, put 1 frame, Loop 2, put 2, in Loop 3, put 3 frames etc. Then, when you animate it, say:

Code (ags) Select
if (oAnimation.Frame <  Game.GetFrameCountForLoop(1, 0)) oAnimation.Animate (1, oAnimation.Frame + 1, eOnce, eNoBlock, eBackwards);
else oAnimation.Animate (1, 0 , eOnce, eNoBlock, eBackwards);