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() {
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!");
}
}
}

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

@ -59,4 +59,8 @@ public class GameManager {
}
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) {
position = newPosition;
}
gameManager.updatePlayerCell();
}
public void processInput(char inputchar) {

Loading…
Cancel
Save