I'm trying to make a zombie survival game when you shoot zombies with a gun. but the problem is that my gun doesn't have a timer on it and just continually shoots. Is anyone able to help me?
Code for the gun \/ \/ \/
public void act
{
//Shooting code here \/ \/ \/
if (Greenfoot.isKeyDown("space")){
fire();
wait(10);
}
}
// fire the bullet
public void fire()
{
Bullet bullet = new Bullet();
getWorld().addObject(bullet, getX(), getY());
}
}
All the other code works, its just that the wait command doesn't work.

