Use arrow keys
Be able to use Left right and the other arrows for stuff.
6
votes
SkyAquatic
shared this idea
-
tristanteodoro commented
Uh it is possible to do that
-
Ryan Bever commented
Here is code for arrow keys
window.focus()
addEventListener('keydown',checkKey)
function checkKey(event) {
pressed = event.key
if (pressed == 's') {
mainLoop = setInterval(shipMover,time)
} else if (pressed == 'ArrowUp') {
ship.rotate(NORTH)
} else if (pressed == 'ArrowLeft') {
ship.rotate(WEST)
} else if (pressed == 'ArrowRight') {
ship.rotate(EAST)
} else if (pressed == 'ArrowDown') {
ship.rotate(SOUTH)
}
}