I was trying to pause the animation with a pause/resume button, by doing this :
public static int gameStatus = 1;
public int gamePaused = 0;
public int gameRunning = 0;
public void create(){
gameRunning = 1;
//.. code
}
public void render(){
if(gameStatus == gameRunning){
//some code ..
pause.setClickListener( new ClickListener() {
@Override
public void click(Actor actor, float x, float y) {
System.out.println("pause is pressed");
//to stop the animation at a particular frame
spriteBatch.begin();
spriteBatch.draw(currentFrame, 100, 100);
spriteBatch.end();
if(gameStatus!=gamePaused)
{
gameStatus = gamePaused;
}
else
{
gameStatus = 1;
}
}
});
//rest of my render animation code ..
}
}
But on the desktop it shows 3/4th of the current frame and 1/4th of the next frame. Any idea why? And in android it behaves like the entire image is shivering.I'm wondering maybe its because its calling render() again and again. I dont understand why there is a difference in the ouput in android and the desktop version. Aren't they supposed to be the same? I think there is some indexing issue between the two. Any body else experienced the same issue? Any suggestions or a proper way to pause the animation or a tutorial link would be really helpful. Thankyou.