ok so I am trying to animate my character "shank", and when It sets the image it stays that image instead of going back to the original which it is supposed to do, here is my code: I believe it is because the variable "time" Is not continuously adding 1 like I want it to be, any suggestions on how to fix?
public void act()
{
int time = 0;
if(Greenfoot.isKeyDown("a")){
move(-2);
time = time + 1;
if(time == 1){
setImage("Shankmove2.jpg");
}
if(time == 2){
time = 0;
}
}
if(Greenfoot.isKeyDown("d")){
move(2);
}
}
