diff --git a/src/main/java/pacmanGame/GameManager.java b/src/main/java/pacmanGame/GameManager.java index 16e7e23..2c6db7d 100644 --- a/src/main/java/pacmanGame/GameManager.java +++ b/src/main/java/pacmanGame/GameManager.java @@ -12,8 +12,8 @@ public class GameManager { visualizer = new VisualizerPlainText(this); player = new Player(this); ghosts = new Ghost[4]; - for(int i = 0; i< ghosts.length; i++) { - ghosts[i] = new Ghost(); + for(int i = 0; i < ghosts.length; i++) { + ghosts[i] = new Ghost(this); } } @@ -28,6 +28,12 @@ public class GameManager { if(inputChar == 27) { //todo: escape key pauses game } + + else if (inputChar == 'w' || inputChar == 's' || inputChar == 'd' || inputChar == 'a') { + player.processInput(inputChar); + } + + else { System.out.println("Unprocessed Input: " + inputChar + " (" + (int)inputChar + ")"); } diff --git a/src/main/java/pacmanGame/Ghost.java b/src/main/java/pacmanGame/Ghost.java index 388fbc7..82f0578 100644 --- a/src/main/java/pacmanGame/Ghost.java +++ b/src/main/java/pacmanGame/Ghost.java @@ -5,7 +5,7 @@ public class Ghost { public final GameManager gameManager; public Ghost(GameManager gameManager) { - this.gameManager = new GameManager(); + this.gameManager = gameManager; } }