Trixt0r / spriter

A Generic Java importer for Spriter animation files.

Home Page:https://brashmonkey.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Non loopable animations

so3arbelnox opened this issue · comments

commented

Hello,

I am using Libgdx with your library and so far its going fairly good. One question I had is how to handle animations that you do not want to loop. In Spriter you can set this via a button and from what I can tell your parser does set loopable to true or false depending on that. However, when calling setAnimation(name), the animation will loop endlessly regardless. My expected behavior would be for it to stop on the last frame, or back to the first.

I also can't quite find a good way to get or set the current frame. Perhaps I am misunderstanding something though. Thank you and I appreciate your work on this library.

To stop a animation at the start or the end, you should use the PlayerListener.
And implement the animationFinished method. In this method you can set the speed to zero with player.speed = 0 and set the time to zero or the last point of time in your animation with player.setTime(yourTime).