Request: "Last Pressed" expression for keyboard

0 favourites
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • I'd like to request the addition of an expression for the keyboard plug-in which returns the last key pressed.

    I'm recording my player's key-presses, and my current approach involves a different event for each key. This would be significantly easier if I could use the "on any key pressed" condition and then use a "last key pressed" expression to identify the key in question.

    It might be too difficult to return some sort of reference or pointer but simply returning the name of the key would be sufficiently useful, as it should then be able to be passed as a parameter to the new function argument.

  • I'll see if I can add something like this for the next build.

  • I'd like to second this request.

  • Thank-you so much Ashley, and thank-you again for such a fantastic product with such a quick and regular update schedule! I wish more developers had your dedication and work-ethic! <img src="smileys/smiley1.gif" border="0" align="middle" />

    I think this feature will be very useful for anyone wanting to record input as I'm doing or for implementing "combo" patterns as often seen in arcade-style fighting games.

  • Just wanted to reply again to say thanks for getting to this -- and an equivalent for gamepad -- so quickly with the latest release!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • , Thank you so much for the custom input support, almost all the big features are in now! :D

    1 additional expression would help though: get a key as character/text (based on keycode). This way I could show the player a string that says "Shift" rather than "Keycode 16".

  • , Thank you so much for the custom input support, almost all the big features are in now!

    1 additional expression would help though: get a key as character/text (based on keycode). This way I could show the player a string that says "Shift" rather than "Keycode 16".

    I'd like to be able to take the last key pressed and instead of returning a keycode, it could return the actual letter typed. I this possible?

  • This could be a valid way to do it... Although, it seems like "Spacebar" doesn't return a string...

    Ashley, is this normal...?

  • This could be a valid way to do it... Although, it seems like "Spacebar" doesn't return a string...

    Ashley, is this normal...?

    I managed to do it well with this: https://dl.dropboxusercontent.com/u/364 ... arCode.zip

  • > This could be a valid way to do it... Although, it seems like "Spacebar" doesn't return a string...

    >

    > Ashley, is this normal...?

    >

    I managed to do it well with this: https://dl.dropboxusercontent.com/u/364 ... arCode.zip

    This method with Kyatric's plugin does return a string for "spacebar", but it produces a lot of other problems, in my opinion of course.

  • >

    > > This could be a valid way to do it... Although, it seems like "Spacebar" doesn't return a string...

    > >

    > > Ashley, is this normal...?

    > >

    > I managed to do it well with this: https://dl.dropboxusercontent.com/u/364 ... arCode.zip

    >

    This method with Kyatric's plugin does return a string for "spacebar", but it produces a lot of other problems, in my opinion of course.

    Aww and there I was thinking it was perfect <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy"> What problems does it produce?

  • Aww and there I was thinking it was perfect What problems does it produce?

    Well, have you tried pressing "Shift", "Enter", "Ctrl", the arrow keys, any of the numpad keys...? Either nothing happens, or totally incorrect characters appear. There are also differences between browsers, in Firefox, pressing "Shift" produces a graphical element but on Edge and Chrome nothing happens.

    I haven't checked it thoroughly, but the default "Keyboard" Plugin seems to be a lot more predictable and functional. It just doesn't register "Spacebar" as a string. But this can be easily implemented with an extra event.

  • >

    > Aww and there I was thinking it was perfect What problems does it produce?

    >

    Well, have you tried pressing "Shift", "Enter", "Ctrl", the arrow keys, any of the numpad keys...? Either nothing happens, or totally incorrect characters appear. There are also differences between browsers, in Firefox, pressing "Shift" produces a graphical element but on Edge and Chrome nothing happens.

    I haven't checked it thoroughly, but the default "Keyboard" Plugin seems to be a lot more predictable and functional. It just doesn't register "Spacebar" as a string. But this can be easily implemented with an extra event.

    How do you convert character codes to actual characters with the keyboard plugin?

  • Zebbi , my example above doesn't work for you? Or am I misinterpreting something, English isn't my strong suite!

  • Zebbi , my example above doesn't work for you? Or am I misinterpreting something, English isn't my strong suite!

    Whoops, missed that! Thanks for that, I've replaced charcode with that (no need for extra plugins if not essential )

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