diff --git a/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin b/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin index 85cea88..3fa4d1b 100644 Binary files a/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin and b/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin differ diff --git a/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.lock b/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.lock index 4672879..eefc693 100644 Binary files a/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.lock and b/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.lock differ diff --git a/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.bin b/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.bin index 9c63fe3..6ff2767 100644 Binary files a/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.bin and b/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.bin differ diff --git a/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.lock b/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.lock index 7ff1fa9..5249cb4 100644 Binary files a/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.lock and b/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.lock differ diff --git a/Happy_Bird/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/Happy_Bird/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 1b2e599..dae35f2 100644 Binary files a/Happy_Bird/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/Happy_Bird/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/Happy_Bird/build/classes/java/main/com/example/happy_bird/HappyBirdMain.class b/Happy_Bird/build/classes/java/main/com/example/happy_bird/HappyBirdMain.class index 2c8c8e9..bff5945 100644 Binary files a/Happy_Bird/build/classes/java/main/com/example/happy_bird/HappyBirdMain.class and b/Happy_Bird/build/classes/java/main/com/example/happy_bird/HappyBirdMain.class differ diff --git a/Happy_Bird/build/libs/Happy_Bird-1.0-SNAPSHOT.jar b/Happy_Bird/build/libs/Happy_Bird-1.0-SNAPSHOT.jar index 7a8ba9a..17ff46a 100644 Binary files a/Happy_Bird/build/libs/Happy_Bird-1.0-SNAPSHOT.jar and b/Happy_Bird/build/libs/Happy_Bird-1.0-SNAPSHOT.jar differ diff --git a/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin b/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin index 52a6773..249d1ed 100644 Binary files a/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin and b/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/Happy_Bird/src/main/java/com/example/happy_bird/FormatingClass.java b/Happy_Bird/src/main/java/com/example/happy_bird/FormatingClass.java index 12b356d..7c9392e 100644 --- a/Happy_Bird/src/main/java/com/example/happy_bird/FormatingClass.java +++ b/Happy_Bird/src/main/java/com/example/happy_bird/FormatingClass.java @@ -158,9 +158,9 @@ public class FormatingClass { public void endScreenFormating(Pane endScreen, Pane pause, Label endScreenHeadline, Label currentScoreEndscreenLabel) { /*Endscreen-Pane formatieren*/ endScreen.setPrefSize(400, 500); - pause.setLayoutX(200); - pause.setLayoutY(100); - pause.setStyle("-fx-background-color: #DED894; " + + endScreen.setLayoutX(200); + endScreen.setLayoutY(100); + endScreen.setStyle("-fx-background-color: #DED894; " + "-fx-border-width: 5px;" + "-fx-border-color: #543847;" + "-fx-border-radius: 15px;" + @@ -175,7 +175,7 @@ public class FormatingClass { "-fx-font-weight: bold;" + "-fx-alignment: center;"); - currentScoreEndscreenLabel.setPrefSize(250,50); + currentScoreEndscreenLabel.setPrefSize(300,50); currentScoreEndscreenLabel.setLayoutX(75); currentScoreEndscreenLabel.setLayoutY(100); currentScoreEndscreenLabel.setStyle("-fx-background-color: #DED894; " + diff --git a/Happy_Bird/src/main/java/com/example/happy_bird/HappyBirdMain.java b/Happy_Bird/src/main/java/com/example/happy_bird/HappyBirdMain.java index 64961fe..37c3f73 100644 --- a/Happy_Bird/src/main/java/com/example/happy_bird/HappyBirdMain.java +++ b/Happy_Bird/src/main/java/com/example/happy_bird/HappyBirdMain.java @@ -23,6 +23,8 @@ import java.util.ArrayList; public class HappyBirdMain extends Application { private int birdPositionMovedBy = 0; private int collectedPoints; + private int playerhighscore; + private boolean openEndScreen = false; /* Formatierungsklasse */ private final FormatingClass formatingClass = new FormatingClass(); @@ -70,8 +72,8 @@ public class HappyBirdMain extends Application { private final Button backButtonPause = new Button("ZURÜCK"); private final Button background1 = new Button(); private final Button background2 = new Button(); - private final Button backMenuButton = new Button(); - private final Button restartGameButton = new Button(); + private final Button backMenuButton = new Button("HAUPTMENÜ"); + private final Button restartGameButton = new Button("NEU STARTEN"); private final Button personalHighscoresButton = new Button ("YOUR SCORES"); private final Button backEndscreenButton = new Button("ZURÜCK"); @@ -121,6 +123,7 @@ public class HappyBirdMain extends Application { /*ArrayList, in der alle Rechtecke/ Pipes gespeichert werden*/ private final ArrayList pipesArrayList = new ArrayList(); + private final ArrayList pipesToRemove = new ArrayList(); /*Timeline, auf der sich die Pipes und der Vogel abspielen*/ private Timeline timeline; @@ -337,7 +340,7 @@ public class HappyBirdMain extends Application { */ public void generateGameScreen() { menuScreenRunning = false; - int playerhighscore = getPlayerHighscore(); + playerhighscore = getPlayerHighscore(); highscoreLabel.setText("HIGHSCORE: " + playerhighscore); /*Headline-Label umbenennen*/ nameLabel.setText("KÜRZEL: " + acronym.getText()); @@ -433,10 +436,17 @@ public class HappyBirdMain extends Application { collisionChecker = new AnimationTimer() { @Override public void handle(long timestamp) { - for (Rectangle rectangle : pipesArrayList) { - if(rectangle != null){ - checkCollision(happyBird,rectangle); + if (!openEndScreen) { + for (Rectangle rectangle : pipesArrayList) { + if (rectangle != null) { + checkCollision(happyBird, rectangle); + } } + for (Rectangle rectangle : pipesToRemove) { + pipesArrayList.remove(rectangle); + } + } else { + generateEndScreen(); } } }; @@ -464,12 +474,16 @@ public class HappyBirdMain extends Application { /*Pausieren der Timeline, sodass keine neuen Pipes spawnen*/ timeline.stop(); gameRunning = false; + openEndScreen = true; } if(happyBird.getBoundsInParent().getMaxX() > pipe.getBoundsInParent().getMaxX()) { collectedPoints++; - int pointstoset = collectedPoints / 2; - currentScoreLabel.setText("SCORE: " + pointstoset); - pipesArrayList.remove(pipe); + int pointsToSet = collectedPoints / 2; + currentScoreLabel.setText("SCORE: " + pointsToSet); + if (pointsToSet > playerhighscore) { + highscoreLabel.setText("HIGHSCORE: " + pointsToSet); + } + pipesToRemove.add(pipe); } } @@ -986,12 +1000,13 @@ public class HappyBirdMain extends Application { currentScoreLabel.setVisible(false); /**/ - endScreen.setVisible(true); + endScreen.getChildren().add(endScreenHeadline); endScreenHeadline.setVisible(true); endScreen.getChildren().add(currentScoreEndscreenLabel); + currentScoreEndscreenLabel.setText("YOUR SCORE: " + collectedPoints / 2); currentScoreEndscreenLabel.setVisible(true); /* Buttons einfügen */ @@ -1012,18 +1027,6 @@ public class HappyBirdMain extends Application { //AB HIER MÜLL - /*Überschrift einblenden - Text auf Game Over setzen */ - headline.setVisible(true); - headline.setText("GAME OVER"); - /*startGameButton anzeigen, Text zu "neu Starten" ändern und positionieren*/ - startGameButton.setVisible(true); - startGameButton.setText("NEU STARTEN"); - /*Button fürs Hauptmenü einblenden und positionieren*/ - menuButton.setVisible(true); - /*Button für persönliche Highscores einblenden und positionieren*/ - personalHighscoresButton.setVisible(true); - //personalHighscoresButton.setLayoutX(); - //personalHighscoresButton.setLayoutY(); }