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(); triggerFruit();
} }
else { else {
System.out.println("cell contains no item!");
//System.out.println("cell contains no item!");
} }
} }
} }

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

@ -28,9 +28,16 @@ public class GameManager {
if(time%5 == 0) { if(time%5 == 0) {
player.Move(); player.Move();
} }
if(time == 300) {
spawnCherry();
}
time++; time++;
} }
public void spawnCherry() {
map.GetCell(map.playerSpawn).type = "cherry";
}
public void ProcessInput(char inputChar) { public void ProcessInput(char inputChar) {
if(inputChar == 27) { if(inputChar == 27) {
//todo: escape key pauses game //todo: escape key pauses game

Loading…
Cancel
Save