How to finish animation with libgdx
libgdx
Solution
You can use
animation.isAnimationFinished(stateTime);
To see if your animation is finished.
For the sprites : personnaly I use TextureRegion from a TextureAtlas and I store them in an array for my animation
Problem
I am trying to implement a simple animation with libGDX and I am currently stuck on one thing. Lets say I have a bunch of sprites which take some time to finish. For example, around 30 sprites like this link: https://github.com/libgdx/libgdx/wiki/2D-Animation However, before the animation completes some key is pressed. For smooth animation I want the 30 frames to be completed before I start the next set of animation, to prevent an abrupt stop. So my question is how do I achieve it this in libGDX? My current idea is to extend the `Animation` class, which would keep track of how frames I have and how many have been rendered and then display the rest. Or use the `isAnimationFinished(float stateTime)` function (though I haven't had luck using that). The examples I have seen like superjumper have very few animations and don't really change that much. Also, is there a way to hold the list of sprites from a `TextureAtlas.createSprites` method and use those with the Animation class? If not, whats the purpose of providing this function? Thanks