how do you have single shot firing


//the beginning of your class, no changes here... public class Player { //your code should be here.... //at the bottom of your player class, after all of your code, add this: private int timeTillCanFire; }
public void fire() { if(timeTillCanFire == 0) { //if can fire now... if(Greenfoot.isKeyDown("space")) { //do whatever you normally do to acually fire. timeTillCanFire = 10; //wait ten frames before you can fire again. } } if(timeTillCanFire != 0) { //if can't fire now... timeTillCanFire--; //wait till can } }