Ok, so I am trying to create animation everytime the player moves the character. Here is what I have:
It highlights the "time = time + 1" and says variable time might not have been initialized. I am not familiar with this error so please educate me on it.
public void act()
{
int time;
if(Greenfoot.isKeyDown("a")){
move(-2);
time = time + 1;
if(time == 3){
setImage("Shankmove2.jpg");
}
}
if(Greenfoot.isKeyDown("d")){
move(2);
}
}
}