[Solved] Is there a way to wait for a keypress?

  • -I have a variable called Talking.

    -Until space is pressed, it equals "".

    -When space is pressed, it equals "Hello".

    I'd like to press it again and have it say something else (ie. press it again and it says "How are you?", then again and it says "Nice day!").

    I know there's the Wait function, but it only appears to be time based. Any help would be greatly appreciated!

    EDIT: I think I found a way to do this in case anyone finds this and is wondering.

    • Set up a second variable to count the number of times Space is released (Add 1 to Counter)
    • Add conditional events for if Count = 1, Count = 2, etc. In these conditional events, set the variable's value
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes using global variables is probably the easiest way.

    You can put the Key Press in your main event and have that set the gobal variable and then put all the check events in sub events under that.

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