From 054494cf2bdc4f9054a1376c4796dfad0313a597 Mon Sep 17 00:00:00 2001 From: fdai7910 Date: Sat, 3 Feb 2024 21:27:06 +0100 Subject: [PATCH] added spawnCherry function in GameManager --- src/main/java/pacmanGame/Cell.java | 2 +- src/main/java/pacmanGame/GameManager.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/pacmanGame/Cell.java b/src/main/java/pacmanGame/Cell.java index db5751f..46d21e3 100644 --- a/src/main/java/pacmanGame/Cell.java +++ b/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!"); } } } diff --git a/src/main/java/pacmanGame/GameManager.java b/src/main/java/pacmanGame/GameManager.java index 9ecaa26..9bf19bc 100644 --- a/src/main/java/pacmanGame/GameManager.java +++ b/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) {