Dammit, will you guys please read the post. He’s using an ATLAS so he’s trying compile the ANIMATION from the ATLAS. Just to stop the unhelpful posts, I’ll explain. You have to use the Animation class of libgdx. Constructor:
explosionAnimation = new Animation(0.15f, explosionAnimationFrames); //0.15f is the frame duration, explosionAnimationFrames is the array of the different frames.
To use this, you need the array of frames. Now, since you are using a texture atlas, just make the explosionAnimationFrames array using the textures from the atlas.
Array<AtlasRegion> explosionAnimationFrames = textureAtlas.findRegions("names-of-regions"); //usually you would organize your textures in the atlas for easy loading, for example start all player textures with "player_"
If you are using the Image class, you will have to also make an array of drawables. To actually use the animation:
private float animationStateTime;
public void foo(float delta){ //delta time, time inbetween frames - libgdx does this for you
TextureRegion frame;
if(condition to start playing animation){
frame = explosionAnimation.getKeyFrame(animationStateTime += delta, false);
}
explosionTexture = frame.getTexture();
}
Again, if you are using Image you will have to set the drawable and use your drawables array.