I am looking for a KeyListener for a game that I am developing in JavaScript. I have no idea how this will work in real code, but it will be something like this:
if(keyPress == upKey) { playerSpriteX += 10; } else if(keyPress == downKey) { playerSpriteY -= 10; }
etc...
I searched for it, and Google came up with AJAX-related things that I donβt understand yet. Is there a built-in function in JavaScript that does this?
javascript key keyboard keylistener
user2423701
source share