stateTime = stateTime + Gdx.graphics.getDeltaTime();
x_position = x_position + velocity * Gdx.graphics.getDeltaTime();
if(x_position > Gdx.graphics.getWidth() - 180){
velocity *= -1;
}else if(x_position < 0 - 20){
velocity *= -1;
}
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(mAnimation.getKeyFrame(stateTime, true), x_position, 10, 200, 200);
batch.end();
我有一个精灵动画,当它到达屏幕的右侧时,它又回到了左侧。如何将精灵动画转到左侧?