korlibs / korge

KorGE Game Engine. Multiplatform Kotlin Game Engine
https://korge.org/
Other
2.42k stars 122 forks source link

Sprite support to ping pong animation forward and then reversed #2254

Open tylerwilbanks opened 3 weeks ago

tylerwilbanks commented 3 weeks ago

I want to play an animation forward and then play it backwards indefinitely. Currently sprite.playAnimationLooped() does not provide this behavior; it only allows for forward or reversed.

soywiz commented 2 weeks ago

Hi @tylerwilbanks . What's your use-case for this? F, B* (Forward and then Backwards in loop)

tylerwilbanks commented 2 weeks ago

I have a 6 frame sprite idle animation where the character decays a bit and then rebuilds itself. It's an idle animation, so of course I want it to repeat indefinitely until the user inputs an action to switch animation.

By having the ping pong animation functionality, I can keep the sprite anim at 6 frames, instead of creating a 12 frame animation with duplicate frames to achieve the same effect.

tylerwilbanks commented 2 weeks ago

Aseprite has this ping pong animation functionality built-in, and by having this same functionality in korge, that would make my workflow between the two tools much smoother.