Skip to content

Instantly share code, notes, and snippets.

@bashbaugh
Last active February 27, 2019 02:20
Show Gist options
  • Save bashbaugh/021b8f4105425a79cd207cd0ffb8ede6 to your computer and use it in GitHub Desktop.
Save bashbaugh/021b8f4105425a79cd207cd0ffb8ede6 to your computer and use it in GitHub Desktop.
function key_pressed(key)
{
... // arrow up block
if (key.key == "ArrowLeft")
{
console.log("left");
player_x -= player_move_increment // reduce player_move_increment, which moves player left
}
if (key.key == "ArrowRight")
{
console.log("right");
player_x += player_move_increment // increase player_move_increment, which moves player right
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment