Skip to content

Instantly share code, notes, and snippets.

@bashbaugh
Last active February 27, 2019 02:05
Show Gist options
  • Save bashbaugh/7c84e2cbf82128aecaf17584632688af to your computer and use it in GitHub Desktop.
Save bashbaugh/7c84e2cbf82128aecaf17584632688af to your computer and use it in GitHub Desktop.
function key_pressed(key)
{
if (key.key == "ArrowUp")
{
console.log("up");
if (start_time == 0) // Only start if not already started
{
start_time = new Date().getTime(); // Store start time
setInterval(update, 1000 / frames_per_second); // Start looping update function
}
}
... // All the rest of the function
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment