game wird neugestartet, nachdem man gestorben ist

master
Lenz Wiechers 2020-06-09 18:58:43 +02:00
parent 8f5ebb93b1
commit 07a7b02819
17 changed files with 40 additions and 34 deletions

14
bin/.gitignore vendored
View File

@ -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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
bin/MapMenu$1.class Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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);

View File

@ -4,28 +4,48 @@
public class Main {
@SuppressWarnings("unused") // Die "unused" - Warnungen werden in dieser Datei nicht mehr angezeigt
static
MapMenu menu;
static Game game;
public static void main(String[] args) {
System.setProperty("sun.java2d.opengl", "true");
MapMenu menu = new MapMenu();
menu = new MapMenu();
while(!menu.rdy) {
delay(1);
while (!menu.rdy) {
delay(100);
}
Game game = new Game(menu.selectedMap + ".txt");
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();
}
public static void delay(int time) {
try {
Thread.sleep(time);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}