I’m trying to develop a JavaScript game engine and I’ve came across this problem:

  • When I press SPACE the character jumps.
  • When I press → the character moves right.

The problem is that when I’m pressing right and then press space, the character jumps and then stops moving.

I use the keydown function to get the key pressed. How can I check if there are multiple keys pressed at once?

16 Answers
16

Leave a Reply

Your email address will not be published. Required fields are marked *