Browse Source

added updatePlayerCell function to GameManager

remotes/origin/player
fdai7910 11 months ago
parent
commit
e83ac8db4f
  1. 5
      src/main/java/pacmanGame/Cell.java
  2. 4
      src/main/java/pacmanGame/GameManager.java
  3. 1
      src/main/java/pacmanGame/Player.java

5
src/main/java/pacmanGame/Cell.java

@ -17,11 +17,13 @@ public class Cell {
} }
public void triggerPill() { public void triggerPill() {
this.type = "empty";
//todo: code //todo: code
} }
public void triggerFruit() { public void triggerFruit() {
//todo: code
this.type = "empty";
map.gameManager.score += 505;
} }
public void triggerItem() { public void triggerItem() {
@ -38,5 +40,4 @@ public class Cell {
System.out.println("cell contains no item!"); System.out.println("cell contains no item!");
} }
} }
} }

4
src/main/java/pacmanGame/GameManager.java

@ -59,4 +59,8 @@ public class GameManager {
} }
return false; return false;
} }
public void updatePlayerCell() {
map.GetCell(player.position).triggerItem();
}
} }

1
src/main/java/pacmanGame/Player.java

@ -24,6 +24,7 @@ public class Player {
if(!newPosIsWall) { if(!newPosIsWall) {
position = newPosition; position = newPosition;
} }
gameManager.updatePlayerCell();
} }
public void processInput(char inputchar) { public void processInput(char inputchar) {

Loading…
Cancel
Save