Observing keydown events in JavaScript when two keys are pressed simultaneously?

I.e. Cursor down is being pressed until you get a keyup for it - you shouldn't be relying on repeated keydown events being sent.

I think he's wanting the avatar to move while the key is being held, then stop on keyup. – ghoppe Jan 25 at 15:28 ghoppe is right. I'm just wondering why the demo (see link above) doesn't work as expected.

I have the same problem with my code which I wrote from scratch. – Sven Jan 25 at 15:40 1 Right, I understand that. I'm saying what you should do is just use the keydown and keyup events to keep track of what keys are pressed, and then do the actual moving in your timer loop.(Presumably you'll have a timer loop, since this is a game and you'll have other game logic to handle.) This will also eliminate the slightly longer delay you get between the first and second "steps".

– kprevas Jan 25 at 15:46 kprevas, that's exactly what I was thinking right now :) I updated the question for clarification. – Sven Jan 25 at 15:48.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions