I have been trying to impliment animation into the game I am working on, here is the code for it:
But the delays seem to interfere with my movement code which is:
And the delays in the first bit of code delay the move(2); as well, how do I stop this? or is there another way of using animation?
public void Animation() { if(Greenfoot.isKeyDown("W")) { setImage("act_char_turn1.png"); Greenfoot.delay(5); setImage("act_char.png"); Greenfoot.delay(5); setImage("act_char_turn-1.png"); Greenfoot.delay(5); setImage("act_char.png"); Greenfoot.delay(5); } }
public void move() { if(Greenfoot.isKeyDown("W")) { move(2); } }