• 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!

Windows More than 3 keys pressed

Chaser

Member
Hi, having a few issues with keyboard_check events.

I'm asking GMS2 to check if there are three keys pressed at the same time.

if key_down && key_right && key_punch
{
change state
}

However this is not working.
So i tried

if key_down && key_right
{
if key_punch
{
change state
}
}

This is not working either.

So i tested just using two key presses

if key_down && key_punch
{
change state
}

This works fine, So GMS2 recognises two buttons pressed at the same time but not three.
I have been told that GMS2 or Windows won't allow you to do more than three key presses at the same time unless you do something somewhere, change a setting, or it depends on what keyboard you are using. it's a little confusing and i'm not sure where to turn to at this point, so I'm hoping one of you guys could point me in the right direction, or enlighten me on how i should approach three button commands. :)
 

rIKmAN

Member
It'
Hi, having a few issues with keyboard_check events.

I'm asking GMS2 to check if there are three keys pressed at the same time.

if key_down && key_right && key_punch
{
change state
}

However this is not working.
So i tried

if key_down && key_right
{
if key_punch
{
change state
}
}

This is not working either.

So i tested just using two key presses

if key_down && key_punch
{
change state
}

This works fine, So GMS2 recognises two buttons pressed at the same time but not three.
I have been told that GMS2 or Windows won't allow you to do more than three key presses at the same time unless you do something somewhere, change a setting, or it depends on what keyboard you are using. it's a little confusing and i'm not sure where to turn to at this point, so I'm hoping one of you guys could point me in the right direction, or enlighten me on how i should approach three button commands. :)
It's probably keyboard ghosting causing you the issue, which you can test for somewhere like here: https://drakeirving.github.io/MultiKeyDisplay/
if you use a different set of keys (or different 3rd key) it will likely work, but whether that is a good combination for input to your game is another matter.
 

Chaser

Member
Thanks @rIKmAN

I changed some of the keyboard keys and its working now, not sure its ideal for what i want, but i can work with it at least, and its not a bad code from myself.

Just for reference in case someone else comes across the same thing i did, didn't find anything in the GM help files.

I was using the 'Arrow Keys' for movement and the 'Num Keys' for actions, this works OK, 2 button checks are OK, but when you move to a third this isn't going to work. There are certain key combinations you cannot use, but this is dependant on the keyboard type you are using and NOT GMS. It's difficult to say what these 'Combinations' are without checking every possibility. What i can say is 'Space' bar cannot be used as a 3 button press check whilst using the arrow keys, or more than one of the 'Num Keys' as mentioned above, but using the 'Letter' keys can be used in combination with the arrow keys. :)

I would say if your planning on using more than 2 key 'combos' in your project then do not use the arrow keys as your movement input, stick with the good old "A,W,S,D" or "Q,A,O,P, Space' (old skool!) just to be safe.
A lot of you probably knew this already, but i didn't!, so for those that didn't like me, hopefully you will find this helpful.

Feel free to add here what combinations that use more then 2 combos that didn't work for you.
 
Top