Browse Source

refactoring: Fixed ghost count stuck at 4

remotes/origin/ghostsbehaviour
fdai7753 11 months ago
parent
commit
d170004c36
  1. 3
      src/main/java/pacmanGame/GameManager.java

3
src/main/java/pacmanGame/GameManager.java

@ -9,13 +9,14 @@ public class GameManager {
public int score = 0; public int score = 0;
public boolean ghostIsEdible = false; public boolean ghostIsEdible = false;
public boolean isPaused; public boolean isPaused;
public final int ghostCount = 10;
public GameManager() { public GameManager() {
setupGame(); setupGame();
} }
public void setupGame(){ public void setupGame(){
ghosts = new Ghost[4];
ghosts = new Ghost[ghostCount];
for (int i = 0; i < ghosts.length; i++) { for (int i = 0; i < ghosts.length; i++) {
ghosts[i] = new Ghost(this, i); ghosts[i] = new Ghost(this, i);
} }

Loading…
Cancel
Save