• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

keyboard_lastkey problem in HTML5

Alivesoft

Member
keyboard_lastkey in HTML5 is not working properly in v1.4.9999, It does not record single key presses, you need to press and hold for a couple of seconds to respond. It works fine in native WIndows.
To see the problem, insert the following in a simple object's step event (and compile under HTML5):

// Get keyboard up/down/left/right
switch (keyboard_lastkey)
{
case 37: x -= 4; break;
case 39: x += 4; break;
case 38: y -= 4; break;
case 40: y += 4; break;
}

// Reset key
keyboard_lastkey = -1;


I know that there are simple ways to work around this, can somebody verify this is a new bug?
 
Last edited:

Alivesoft

Member
Thanks for the reply. I have GMS2 but in my current project I am sticking with 1.4 because it is too risky to convert to 2 this late in the development.
I guess 1.4 will never see this bug fix, so I have to use a work around. Good thing keyboard_key still works.
 
I

icuurd12b42

Guest
use keyboard_key or keyboard_lastchar in the meanwhile
switch (keyboard_key)

or, since your case statement is keys in the ascii range keyboard_lastchar should work

switch (ord(string_upper(keyboard_lastchar)))
 
Top