Hello everyone,
I need some help with a game that I am making. You play as a turret where you have to hold down space (the set key) to shoot a stream of bullets at enemies. I have been able to make the bullets spawn wherever the front of the player is facing, but when I hold down space bar too many bullets spawn out from the turret. Does anyone know a way to slow down or reduce the spawn of the bullets when holding down space bar?
thanks in advance :)
here is the bullet spawn code in the turret actor
(This code is in the public void act section of the turret actor)
1 2 3 4 5 6 | if (Greenfoot.isKeyDown( "space" )){ getWorld().addObject( new Bullet(getRotation()), getX(), getY()); GreenfootSound sound = new GreenfootSound( "turretsfx.wav" ); sound.play(); } |