Browse Source

remaining Lives and failed Attempts

remotes/origin/menu
fdai2751 11 months ago
parent
commit
2252f665fc
  1. 20
      src/main/java/pacmanGame/GameManager.java

20
src/main/java/pacmanGame/GameManager.java

@ -8,9 +8,13 @@ public class GameManager {
public Player player; public Player player;
public int score = 0; public int score = 0;
public boolean isPaused; public boolean isPaused;
public int livesRemaining;
public int failedAttempts;
public GameManager() { public GameManager() {
setupGame();
livesRemaining = 3;
failedAttempts = 0;
setupGame();
} }
public void setupGame(){ public void setupGame(){
@ -22,10 +26,20 @@ public class GameManager {
for(int i = 0; i < ghosts.length; i++) { for(int i = 0; i < ghosts.length; i++) {
ghosts[i] = new Ghost(this); 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() { public void Update() {
if(!isPaused) { if(!isPaused) {
visualizer.Update(); visualizer.Update();

Loading…
Cancel
Save