Animation: Playing all frames, then looping between 2nd to last

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By XYZDev

What I want to do seems like it should be extremely simple. I want to make my Running and Jumping animations play all frames, then loop between all frames except the first.

1,2,3,4,5,6,7,8 > 2,3,4,5,6,7,8 > 2,3,4,5,6,7,8

I don’t know how there are numerous tutorials for 2D Platformers and none of them have even TOUCHED on this basic concept. I have been searching for days and haven’t been able to find ANY relevant information ANYWHERE to the point I’m near ready to give up.

:bust_in_silhouette: Reply From: Socrates

I don’t know if it’s possible to do exactly as you describe, but you can just make two separate animations the first plays 1 and the second looping 2 through 8. Then connect the animation_finished signal to a function that plays the second animation if the animation_finished string == the name of the first animation.

A word of warning: if I recall correctly the animation_finished signal is emitted as soon as the last frame of the animation is displayed, not after it has been displayed for as much time as the animation framerate implies. To avoid “skipping” the last frame when switching animations using animation_finished, you can add a blank dummy last frame, or use a timer to control the animation switching instead. I could be wrong about this, it’s been a while since I used animation_finished, so ymmv?

markopolo | 2018-04-09 04:46

The two of you collectively have pulled together ideas that have helped me greatly.

I’ve seperated the animations into two warmup and looped sets. The warmup sets have dummy frames to make them last longer, and each have been assigned timers to extend and shorten the frames.

Getting back to it now. Thank you both very much!

XYZDev | 2018-04-09 15:13