I'm trying move animation within screen, here's the code
Animation<TextureRegion> animation_run = GifDecoder.loadGIFAnimation(Animation.PlayMode.LOOP,
Gdx.files.internal("run.gif").read());
float elapsedTime += (Gdx.graphics.getDeltaTime()) * 2;
float playablePosition = (Gdx.graphics.getWidth()) / 2 - 200;
float currentPosition = 0;
for (int i = 0; currentPosition <= playablePosition; i++) {
currentPosition += i;
batch.begin();
batch.draw(animation_run.getKeyFrame(elapsedTime), currentPosition, 0, 200, 300);
batch.end();
}
but I got not exactly what I want
Does anybody know how fix my code to make movement from left edge to the center properly?