Browse Source

Fixed Error in Ghost Constructor

remotes/origin/menu
fdai7012 11 months ago
committed by Julian Wenzel
parent
commit
712f058eb8
  1. 8
      src/main/java/pacmanGame/GameManager.java
  2. 2
      src/main/java/pacmanGame/Ghost.java

8
src/main/java/pacmanGame/GameManager.java

@ -13,7 +13,7 @@ public class GameManager {
player = new Player(this);
ghosts = new Ghost[4];
for(int i = 0; i < ghosts.length; i++) {
ghosts[i] = new Ghost();
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 + ")");
}

2
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;
}
}
Loading…
Cancel
Save