Browse Source

added spawnCherry function in GameManager

remotes/origin/player
fdai7910 11 months ago
parent
commit
054494cf2b
  1. 2
      src/main/java/pacmanGame/Cell.java
  2. 7
      src/main/java/pacmanGame/GameManager.java

2
src/main/java/pacmanGame/Cell.java

@ -37,7 +37,7 @@ public class Cell {
triggerFruit();
}
else {
System.out.println("cell contains no item!");
//System.out.println("cell contains no item!");
}
}
}

7
src/main/java/pacmanGame/GameManager.java

@ -28,8 +28,15 @@ public class GameManager {
if(time%5 == 0) {
player.Move();
}
if(time == 300) {
spawnCherry();
}
time++;
}
public void spawnCherry() {
map.GetCell(map.playerSpawn).type = "cherry";
}
public void ProcessInput(char inputChar) {
if(inputChar == 27) {

Loading…
Cancel
Save