This site requires JavaScript, please enable it in your browser!
Greenfoot back
DaRafster
DaRafster wrote ...

2020/2/22

Removing the ability to spam keys

DaRafster DaRafster

2020/2/22

#
Hi, I managed to map out a sound file and an image file to the space key, however if you spam the space key, the sound file can't seem catch up to the flashing image. So how would I add a delay of some sort that would only allow the player to press the space key every 2 seconds?
danpost danpost

2020/2/22

#
DaRafster wrote...
Hi, I managed to map out a sound file and an image file to the space key, however if you spam the space key, the sound file can't seem catch up to the flashing image. So how would I add a delay of some sort that would only allow the player to press the space key every 2 seconds?
Add an int delay (timer) field. Set it to 120 when space is pressed. Reduce its value by one if it is not zero. Put condition on checking space key that its value must be zero.
You need to login to post a reply.