Browse Source

fixed nullPointerException in Cell

remotes/origin/player
fdai7910 11 months ago
parent
commit
2954a0c866
  1. 9
      src/main/java/pacmanGame/Cell.java

9
src/main/java/pacmanGame/Cell.java

@ -19,9 +19,9 @@ public class Cell {
public void triggerPill() { public void triggerPill() {
this.type = "empty"; this.type = "empty";
gameManager.score += 100;
gameManager.timeStopPillEffect = gameManager.time + 200;
gameManager.ghostIsEdible = true;
map.gameManager.score += 100;
map.gameManager.timeStopPillEffect = map.gameManager.time + 200;
map.gameManager.ghostIsEdible = true;
} }
@ -45,6 +45,8 @@ public class Cell {
map.gameManager.score += 205; map.gameManager.score += 205;
} }
public void triggerItem() { public void triggerItem() {
if(type.equals("dot")) { if(type.equals("dot")) {
triggerDot(); triggerDot();
@ -64,6 +66,7 @@ public class Cell {
else if(type.equals("apple")) { else if(type.equals("apple")) {
triggerApple(); triggerApple();
} }
else { else {
//System.out.println("cell contains no item!"); //System.out.println("cell contains no item!");
} }

Loading…
Cancel
Save