diff --git a/bin/.gitignore b/bin/.gitignore deleted file mode 100644 index 99d9929..0000000 --- a/bin/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -/BigPoint.class -/Brick.class -/Game.class -/Ghost.class -/Hintergrund.class -/Lives.class -/Main.class -/Map.class -/MapMenu$1.class -/MapMenu.class -/Picture.class -/Player.class -/Point.class -/Portal.class diff --git a/bin/BigPoint.class b/bin/BigPoint.class index e13d6a9..c61b68a 100644 Binary files a/bin/BigPoint.class and b/bin/BigPoint.class differ diff --git a/bin/Brick.class b/bin/Brick.class index 98f1c69..50ef0ed 100644 Binary files a/bin/Brick.class and b/bin/Brick.class differ diff --git a/bin/Game.class b/bin/Game.class index 5bd7d58..77f5f51 100644 Binary files a/bin/Game.class and b/bin/Game.class differ diff --git a/bin/Ghost.class b/bin/Ghost.class index ed12e0e..697b081 100644 Binary files a/bin/Ghost.class and b/bin/Ghost.class differ diff --git a/bin/Hintergrund.class b/bin/Hintergrund.class index 10d6ae6..e25986c 100644 Binary files a/bin/Hintergrund.class and b/bin/Hintergrund.class differ diff --git a/bin/Lives.class b/bin/Lives.class index 00ef116..4ea4f45 100644 Binary files a/bin/Lives.class and b/bin/Lives.class differ diff --git a/bin/Main.class b/bin/Main.class index 084339f..f731d3f 100644 Binary files a/bin/Main.class and b/bin/Main.class differ diff --git a/bin/Map.class b/bin/Map.class index 386fbdb..47423ff 100644 Binary files a/bin/Map.class and b/bin/Map.class differ diff --git a/bin/MapMenu$1.class b/bin/MapMenu$1.class new file mode 100644 index 0000000..499879e Binary files /dev/null and b/bin/MapMenu$1.class differ diff --git a/bin/MapMenu.class b/bin/MapMenu.class index 66a3feb..a1f816d 100644 Binary files a/bin/MapMenu.class and b/bin/MapMenu.class differ diff --git a/bin/Picture.class b/bin/Picture.class index 3737254..f720bca 100644 Binary files a/bin/Picture.class and b/bin/Picture.class differ diff --git a/bin/Player.class b/bin/Player.class index 30a6317..cdeb01b 100644 Binary files a/bin/Player.class and b/bin/Player.class differ diff --git a/bin/Point.class b/bin/Point.class index c366510..8be2f7a 100644 Binary files a/bin/Point.class and b/bin/Point.class differ diff --git a/bin/Portal.class b/bin/Portal.class index 1eaeaf9..be456d5 100644 Binary files a/bin/Portal.class and b/bin/Portal.class differ diff --git a/src/Game.java b/src/Game.java index 1df99ed..0e3e19c 100644 --- a/src/Game.java +++ b/src/Game.java @@ -145,7 +145,7 @@ public class Game { delay(1000); frame.setVisible(true); - while (true) { // Main-Loop + while (player.lives > 0) { // Main-Loop dt = System.nanoTime() - lastT; // delta time lastT = System.nanoTime(); // delta time @@ -403,7 +403,8 @@ public class Game { liveLabels[player.lives].setBounds(0, 0, 0, 0); // Das herz wird "entfernt" if (player.lives == 0) { // Wenn der Spieler keine Leben mehr übrig hat - System.exit(0); // Das Programm wird beendet + fpsLabel.setText("YOU LOST"); + delay(3000); } delay(200); // Damit nicht sofort wieder alle losgeht @@ -444,7 +445,6 @@ public class Game { if (empty) { fpsLabel.setText("YOU WON"); delay(5000); - System.exit(0); // Das Programm wird beendet // HIER DEN HIGHSCORE IMPLEMENTIEREN } } @@ -472,7 +472,7 @@ public class Game { } // Methode zum verzögern (warten) in ms - public void delay(int time) { + private void delay(int time) { try { Thread.sleep(time); diff --git a/src/Main.java b/src/Main.java index da3e939..331efa5 100644 --- a/src/Main.java +++ b/src/Main.java @@ -3,29 +3,49 @@ // Muss ausgeführt werden zum Starten public class Main { + + static - @SuppressWarnings("unused") // Die "unused" - Warnungen werden in dieser Datei nicht mehr angezeigt + MapMenu menu; + + static Game game; public static void main(String[] args) { System.setProperty("sun.java2d.opengl", "true"); - MapMenu menu = new MapMenu(); - - while(!menu.rdy) { - delay(1); + menu = new MapMenu(); + + while (!menu.rdy) { + delay(100); } - - Game game = new Game(menu.selectedMap + ".txt"); - - } - - // Methode zum verzögern (warten) in ms - public static void delay(int time) { - try { - Thread.sleep(time); - } catch (InterruptedException e) { - e.printStackTrace(); + + game = new Game(menu.selectedMap + ".txt"); + + while (true) { + + game.frame.dispose(); + + menu = null; + game = null; + + menu = new MapMenu(); + + while (!menu.rdy) { + delay(100); } + + game = new Game(menu.selectedMap + ".txt"); } + + } + + // Methode zum verzögern (warten) in ms + public static void delay(int time) { + try { + Thread.sleep(time); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } } \ No newline at end of file