0
Key events javascript
Making a game and I wanna use key event press Ctrl key my player shoot a ball. I tried to use keydown and up but it makes him shoot more than one ball in one click. Any suggestions
5 Respuestas
+ 1
I'm not 100% sure but I gues keydown should work (if not, add array which will store key down in keydown event and swap on keyup
+ 1
You can make array named for instance keys, than you can in keydown set keys[e.keyCode] to true and in key up false
+ 1
I weren't doing this for long so I'm not really sure about key event properties name
0
nicolas turek I am using keyup and keydown. In key up I set ctrlkey=false. And in keydown I set it again to true. I didn't get the array thing
0
It is okay nicolas turek thank you ^^