4

I am experiencing a strange problem with JavaScript. I am working on a HTML5 canvas game that uses keyboard input. The two player mode of the game involves up to 6 keys on the keyboard being pressed and held down.

It seems like the "keyDown" event stops being called after I hold 4 or 5 keys down on the keyboard.

The code I am using is below:

window.onkeydown = function (event) {
    console.log(event.keyCode);
    input.onKeyDown(event.keyCode);
};

The console should log a key code for each key I press down. However, it only seems to report the keycode for the first 4 or 5 I hold down. This is causing the controls for the two player version of my game to not work when both players press too many keys.

Is this a bug, a limitation of JavaScript/HTML5, or am I doing something wrong?

1 Answers1

1

This is a limitation of the USB keyboard not of your code!

jknight
  • 141
  • 1
  • 7