From 2252f665fcd6f2d99d51982eee736c8804c46a67 Mon Sep 17 00:00:00 2001 From: fdai2751 Date: Wed, 7 Feb 2024 16:35:32 +0100 Subject: [PATCH] remaining Lives and failed Attempts --- src/main/java/pacmanGame/GameManager.java | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/java/pacmanGame/GameManager.java b/src/main/java/pacmanGame/GameManager.java index 62063b7..9fb1d97 100644 --- a/src/main/java/pacmanGame/GameManager.java +++ b/src/main/java/pacmanGame/GameManager.java @@ -8,9 +8,13 @@ public class GameManager { public Player player; public int score = 0; public boolean isPaused; + public int livesRemaining; + public int failedAttempts; public GameManager() { - setupGame(); + livesRemaining = 3; + failedAttempts = 0; + setupGame(); } public void setupGame(){ @@ -22,10 +26,20 @@ public class GameManager { for(int i = 0; i < ghosts.length; i++) { ghosts[i] = new Ghost(this); } - isPaused = false; - + isPaused = false; + } + /* public void handleGhostCollision() { + livesRemaining--; // Reduziere verbleibende leben um 1 + failedAttempts++; // Erhöhe die Anzahl der Fehlversuche + if(livesRemaining <= 0) { + gameOver(); //wenn Keine Leben mehr übrig sind. + } } + public void gameOver() { + // todo + } + */ public void Update() { if(!isPaused) { visualizer.Update();