Last active
February 27, 2019 02:05
-
-
Save bashbaugh/7c84e2cbf82128aecaf17584632688af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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