diff --git a/src/main/java/pacmanGame/Cell.java b/src/main/java/pacmanGame/Cell.java index 808cde1..db5751f 100644 --- a/src/main/java/pacmanGame/Cell.java +++ b/src/main/java/pacmanGame/Cell.java @@ -17,11 +17,13 @@ public class Cell { } public void triggerPill() { + this.type = "empty"; //todo: code } public void triggerFruit() { - //todo: code + this.type = "empty"; + map.gameManager.score += 505; } public void triggerItem() { @@ -38,5 +40,4 @@ public class Cell { System.out.println("cell contains no item!"); } } - } diff --git a/src/main/java/pacmanGame/GameManager.java b/src/main/java/pacmanGame/GameManager.java index 818d0ed..9ecaa26 100644 --- a/src/main/java/pacmanGame/GameManager.java +++ b/src/main/java/pacmanGame/GameManager.java @@ -59,4 +59,8 @@ public class GameManager { } return false; } + + public void updatePlayerCell() { + map.GetCell(player.position).triggerItem(); + } } diff --git a/src/main/java/pacmanGame/Player.java b/src/main/java/pacmanGame/Player.java index fb8c3f0..b729254 100644 --- a/src/main/java/pacmanGame/Player.java +++ b/src/main/java/pacmanGame/Player.java @@ -24,6 +24,7 @@ public class Player { if(!newPosIsWall) { position = newPosition; } + gameManager.updatePlayerCell(); } public void processInput(char inputchar) {