diff --git a/src/main/java/pacmanGame/GameManager.java b/src/main/java/pacmanGame/GameManager.java index 2b6e210..ff8c542 100644 --- a/src/main/java/pacmanGame/GameManager.java +++ b/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(); + } + } }