Search code examples
mit-scratch

How to stop user from holding down space bar?


I am creating a scratch project where you have to press space bar to move and I have found an exploit: holding down space bar because the project is designed to improve your SBPS (space bars per second) not just hold down space bar. How can I stop the user from holding space bar then?


Solution

  • I already know that you are checking if the user is pressing the space bar, that's a good start!

    You have to stop recording any space bar press when the user has pressed the space bar.

    After that start recording the space bar press again once the user has released the space bar so that they would be discouraged from such an exploit.

    Here's an example code block:

    code screenshot

    (from enblazingfire's answer on the Scratch Forums)