I have an actor in a little kungfu game who can kick, punch, jump, jumpkick, crouch, crouchkick and crouchpunch. These actions should be performed once by the push of a button. I.E. when "a" is pressed the actor should kick once. However, when "a" is pressed the actor keeps kicking. I have been playing around with booleans but can't seem to figure this out. The action itself is basically just a change of image. Can anyone help me out please? Here's the base i've been using code for a kick:
if(Greenfoot.isKeyDown("a") && facingLeft==true) //left kick
{
if (getImage().equals(image3) || getImage().equals(image1) || getImage().equals(image2)) {
setImage(image9); // wijzig afbeelding naar afbeelding 9
Greenfoot.playSound("kick.wav");
}
else { // afbeelding 2 wordt getoond
setImage(image1); // wijzig afbeelding naar afbeelding 1
}
}

