I’ve been working on my game and now, my player needs to shoot. He does shoot but to decrease the ammo, it keeps decreasing as long as I hold the space bar. I’d like to know a code that lets me remove -1 ammo each time the spacebar is pressed and even if it’s still pressed. Thanks, hope you answer me soon!
Share
On key down, initialize and start a
java.util.Timerwith initial delay 0 and delay X (however frequently you want to fire.On key up, stop the timer.