I'm trying to make my knight attack an orc. When the space is pressed I want to show an image and attack (remove) the orc. After the image is shown, it goes back to the original images on the Knight. How can I does this, the code i have is not doing anything when the space is pressed. Let me know if you need any more of the code.
public void checkSpace() { if (Greenfoot.isKeyDown("space")) { setImage(M1); if (isTouching(Orc.class)) { frame = 1; Orc orc = (Orc) getOneIntersectingObject(Orc.class); getWorld().removeObject(orc); } } frame ++; }