It is probably because of where you are setting the image.
// start your act method with public void act() { if (stunTimer > 0) // if frozen { stunTimer--; if (stunTimer > 0) return; // if timer not done, exit method setImage("up.png"); // restore normal image } // rest of act method }
// start your act method with public void act() { if (stunTimer > 0) // if frozen { stunTimer--; if (stunTimer > 0) return; // if timer not done, exit method setImage("up.png"); // restore normal image } // rest of act method }
// run timer in player act method if (invincibleTimer > 0) invincibleTimer--; // restrict the execution of the player dying if (invincibleTimer == 0) { // check player's death }