diff --git a/src/main/java/pacmanGame/Cell.java b/src/main/java/pacmanGame/Cell.java index a077a59..f9cd74b 100644 --- a/src/main/java/pacmanGame/Cell.java +++ b/src/main/java/pacmanGame/Cell.java @@ -20,8 +20,9 @@ public class Cell { public void triggerPill() { this.type = "empty"; gameManager.score += 100; - int timeStopPillEffect = gameManager.time + 200; + gameManager.timeStopPillEffect = gameManager.time + 200; gameManager.ghostIsEdible = true; + } public void triggerFruit() { diff --git a/src/main/java/pacmanGame/GameManager.java b/src/main/java/pacmanGame/GameManager.java index 6c60efb..544b401 100644 --- a/src/main/java/pacmanGame/GameManager.java +++ b/src/main/java/pacmanGame/GameManager.java @@ -7,7 +7,8 @@ public class GameManager { public Visualizer visualizer; public Player player; public int score = 0; - public Boolean ghostIsEdible = false; + public boolean ghostIsEdible = false; + public int timeStopPillEffect; public GameManager() { setupGame(); @@ -35,6 +36,10 @@ public class GameManager { if (time == 600) { destroyCherry(); } + if(ghostIsEdible) { + if(time == timeStopPillEffect) + ghostIsEdible = false; + } time++; } @@ -78,11 +83,4 @@ public class GameManager { public void updatePlayerCell() { map.GetCell(player.position).triggerItem(); } - - public void makeGhostEdible(int timeStopPillEffect) { - ghostIsEdible = true; - if(time == timeStopPillEffect) { - ghostIsEdible = false; - } - } }