Browse Source

refactoring: formatting

main
fdai7012 11 months ago
parent
commit
90a35cdca9
  1. 17
      src/main/java/pacmanGame/GameManager.java

17
src/main/java/pacmanGame/GameManager.java

@ -39,11 +39,11 @@ public class GameManager {
}
public void handleGhostCollision() {
livesRemaining--; // Reduziere verbleibende leben um 1
livesRemaining--;
failedAttempts++; // Erhhe die Anzahl der Fehlversuche
failedAttempts++;
if(livesRemaining <= 0) {
gameOver(); //wenn Keine Leben mehr brig sind.
gameOver();
}
}
@ -51,10 +51,9 @@ public class GameManager {
public void gameOver() {
System.out.println("Das Spiel ist vorbei! Pech!!");
}
public void Update() {
public void Update() {
visualizer.Update();
if(!isPaused) {
if(time%moveSpeed == 0) {
player.Move();
@ -64,7 +63,6 @@ public class GameManager {
}
time++;
}
if(time == 300) {
spawnFruit();
}
@ -105,15 +103,11 @@ public class GameManager {
}
public void teleportPlayer(String destination) {
player.position = map.findCellByString(destination).pos;
}
public boolean GhostPlayerColisionTest() {
for(int i = 0; i < ghosts.length; i++) {
for(int x = 0; x < map.size.x; x++) {
for(int y = 0; y < map.size.y; y++) {
if(player.position.equals(ghosts[i].position))
@ -137,12 +131,15 @@ public class GameManager {
ghostIsEdible = false;
}
}
public void Pause() {
isPaused = true;
}
public void Unpause() {
isPaused = false;
}
public void TogglePause() {
if(isPaused) {
Unpause();

Loading…
Cancel
Save