2D Toolkit Forum
2D Toolkit => Support => Topic started by: 39thstreet on April 27, 2012, 10:57:46 pm
-
What's the best way to have an animation hold on a frame for a few before continuing?
That is, let's say I wanted to hold on frame 2 for 5 frames. Should I do a trigger and pause the animation then resume play after 5 updates? Or should I enter frame 2 5 times in a row?
Related question: is there a way to tell a sprite animation to go to a particular frame? I know tk2dAnimationSprite has Play(float clipStartTime), but frame index/number would be way more useful than a clipStartTime for me.
I would appreciate any advice on the best approach.
As an aside, before I decided to use 2dtoolkit I was using ex2d, and the only feature they really did better was the animation editor. I would love to see something more robust (like specific timing per frame on animation rather than global FPS).
-
The best way (for now) is probably just to add frame 2 5x in the editor. When you increase the number of frames in the editor, it extends the last selected one, so you don't have to enter that multiple times.
I've added a PlayFromFrame function to 1.70 beta 3. Would appreciate it if you could have a quick test to see if it works properly before 1.70 final. (Gonna release it very shortly)
I've heard the requests for a better animation editor, and that is definitely one of 2 things which I could end up doing after 1.70 is done :)
-
I've added a PlayFromFrame function to 1.70 beta 3. Would appreciate it if you could have a quick test to see if it works properly before 1.70 final. (Gonna release it very shortly)
Awesome, will check it out today!
-
Follow up:
Worked as described!
I hacked in another addition, though. I also needed a "jump to frame" function, to jump an animation to a particular frame and then pause it. I added this myself in tk2dAnimatedSprite by adding a function which sets a "pause on next update" boolean. Ugly hack, but it'll work for now.
-
A better alternative to hacking into the current codebase is to use c# extension methods. This way your changes will be preserved across version updates.