Skip to content

Instantly share code, notes, and snippets.

@bashbaugh
Last active February 24, 2019 22:04
Show Gist options
  • Select an option

  • Save bashbaugh/e9e8bf2a92a998f3b25eaf212bbf12d8 to your computer and use it in GitHub Desktop.

Select an option

Save bashbaugh/e9e8bf2a92a998f3b25eaf212bbf12d8 to your computer and use it in GitHub Desktop.
function key_pressed(key) //called when a key is pressed
{
// key.key is the name of the key
if (key.key == "ArrowUp")
{
console.log("up");
}
if (key.key == "ArrowLeft")
{
console.log("left");
}
if (key.key == "ArrowRight")
{
console.log("right");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment