How do I register just one keyboard press?

0 favourites
  • 4 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • Hello, I am making a game when my player has to cut an object by pressing at the right moment.

    In order to do that, I disabled my collision at the start of the layout and if I press Space I enable the collision, and if I release I disable the collsion.

    But my problem here is that if you keep pressing space, it is not the kind of comportment that I want, I only want a "one time press" but I don't know how to avoid the long press behaviour.

    If someone can help me please ! 😁

  • Be sure to use 'on key pressed' which is a trigger once. To only allow one press of the key, add a condition if variable=something on the 'on key pressed' event and then add an action to change the variable to something else, which then locks out the key press as variable is no longer true.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hello thank you for you reply. I'm using 'on key pressed' but my problem here is that the user can keep the key pressed as long as he wants it will cut indefinitely, I don't know how to prevent that and be sure to cut only once, as the moment he presses the key, and event though he doesn't release the key I don't want to trigger any more cuts

  • That shouldn't be the case unless you're using 'key is down'. Check out the second part of my response and see if that fixes it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)