Browse Source

added the togglePause fonction in to gameManager and changed the pause instruction on ESC

remotes/origin/menu
fdai2751 11 months ago
parent
commit
49c14a486e
  1. 13
      src/main/java/pacmanGame/GameManager.java

13
src/main/java/pacmanGame/GameManager.java

@ -35,8 +35,8 @@ public class GameManager {
}
public void ProcessInput(char inputChar) {
if(inputChar == 27) {
//todo: escape key pauses game
if(inputChar == 27) {// 27 = ESC
TogglePause();
}
else if (inputChar == 'w' || inputChar == 's' || inputChar == 'd' || inputChar == 'a') {
player.processInput(inputChar);
@ -68,5 +68,12 @@ public class GameManager {
public void Unpause() {
isPaused = false;
}
public void TogglePause() {
if(isPaused) {
Unpause();
}
else {
Pause();
}
}
}
Loading…
Cancel
Save