How do I Test For Keyboard Presses

  • Hi, again.

    Currently, I'm trying to get a system working where if you press on the keyboard, the button is typed down on screen and the system can compare that text to a text constant and figure out what to do next.

    I have it down as the following:

    --------------------------------------------------------------------------------------------------------------------------------------------------------------

    Global constant text PRESSN = "N"

    Global constant text typeCheck = 0

    System PRESSN= "Keyboard.StringFromKeyCode" | System typeCheck (greater or equal to) 1 | System Every tick

    Cursor2 Append "N"

    --------------------------------------------------------------------------------------------------------------------------------------------------------------

    (Note: the point of the "typeCheck" variable is to limit when the text will be type on screen and is changed to "1" once you are allowed to type on another event)

    And then from there on another event I would have it check that "Cursor2" would have written down "N" and continue on with the event for "N". My problem is that I don't necessarily understand the keyboard expressions and therefor probably am using it wrong. Please help!

  • I guess I don't understand what exactly you are trying to do..

    Why not just use text append : Keyboard.StringFromKeyCode

    Or a simple keyboard on n pressed?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I just had a dumb moment. I didn't realize that Keyboard On meant that you could then choose which key you pressed. Thanks for clearing that up for me.

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