I want to draw an animation, the size of each frame is 500x500px but when I try to resize, the animation seems to rotate…
Here the code to load frames and create animation:
Texture fireSheet = new Texture(Gdx.files.internal("fire_sheet.png"));
TextureRegion[] fireFrames = new TextureRegion[4];
fireFrames[0] = new TextureRegion(fireSheet,0,0,500,500);
fireFrames[1] = new TextureRegion(fireSheet,700,0,1200,500);
fireFrames[2] = new TextureRegion(fireSheet,1450,0,1950,500);
fireFrames[3] = new TextureRegion(fireSheet,2250,0,2750,500);
fireAnimation = new Animation(0.5f, fireFrames);
In draw method I resize the animation in this way:
public void draw(Batch batch, float parentAlpha) {
batch.enableBlending();
stateTime += Gdx.graphics.getDeltaTime();
currentFrame = Assets.fireAnimation.getKeyFrame(stateTime, true);
batch.draw(currentFrame, getX(), getY(), 200, 200 );
}
So if I use:
batch.draw(currentFrame, getX(), getY() ); // WORKS!!! But too Big for me 500x500px
Instead if I use:
batch.draw(currentFrame, getX(), getY(), 200, 200 ); // Animation doesn't work properly
What Can I do?
Thank you in advance