set startframe for animation

Started by selmiak, Sun 03/03/2013 19:13:47

Previous topic - Next topic

selmiak

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
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?

Khris

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.

Scavenger

#2
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
if (oAnimation.Frame <  Game.GetFrameCountForLoop(1, 0)) oAnimation.Animate (1, oAnimation.Frame + 1, eOnce, eNoBlock, eBackwards);
else oAnimation.Animate (1, 0 , eOnce, eNoBlock, eBackwards);

SMF spam blocked by CleanTalk