Skip to content

Instantly share code, notes, and snippets.

Created September 23, 2015 12:00
Show Gist options
  • Save anonymous/069781bdb49d0077320b to your computer and use it in GitHub Desktop.
Save anonymous/069781bdb49d0077320b to your computer and use it in GitHub Desktop.
PS.keyDown = function (key, shift, ctrl, options) {
"use strict";
if(GAME.running && !GAME.paused){
movePlayer(key);
if(key == 112){
PS.timerStop(sTimerID);
PS.debug("Game is paused.\n");
GAME.paused = true;
}
}
else if(GAME.running && GAME.paused){
PS.debugClear();
PS.debug("Game is paused.\n");
if(key == 112){
sTimerID = PS.timerStart(GAME.clock, gameUpdate);
PS.debug("Game is unpaused.\n");
GAME.paused = false;
}
}
else{
PS.debugClear();
PS.debug("Press r to restart game!\n");
if(key == 114){
GameSetup();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment