Fix für den Restart-Button - mehrere Neustarts ergeben keine Fehler

This commit is contained in:
Mats Pape 2022-01-25 12:57:24 +01:00
parent 3610c3fb7a
commit 43ba9226e2
10 changed files with 8 additions and 2 deletions

View File

@ -176,7 +176,7 @@ public class FormatingClass {
"-fx-alignment: center;"); "-fx-alignment: center;");
currentScoreEndscreenLabel.setPrefSize(300,50); currentScoreEndscreenLabel.setPrefSize(300,50);
currentScoreEndscreenLabel.setLayoutX(75); currentScoreEndscreenLabel.setLayoutX(50);
currentScoreEndscreenLabel.setLayoutY(100); currentScoreEndscreenLabel.setLayoutY(100);
currentScoreEndscreenLabel.setStyle("-fx-background-color: #DED894; " + currentScoreEndscreenLabel.setStyle("-fx-background-color: #DED894; " +
"-fx-text-fill: #000000; " + "-fx-text-fill: #000000; " +

View File

@ -1042,7 +1042,12 @@ public class HappyBirdMain extends Application {
for (Rectangle pipe : pipesArrayList) { for (Rectangle pipe : pipesArrayList) {
pane.getChildren().remove(pipe); pane.getChildren().remove(pipe);
} }
pipesArrayList.clear();
collectedPoints = 0; collectedPoints = 0;
currentScoreLabel.setText("SCORE: " + collectedPoints);
endScreenOpened = false;
openEndScreen = false;
endScreen.getChildren().clear();
startGameButtonClick(); startGameButtonClick();
} }
@ -1057,6 +1062,7 @@ public class HappyBirdMain extends Application {
button.setVisible(false); button.setVisible(false);
} }
/* Back-Button einblenden */ /* Back-Button einblenden */
backEndscreenButton.setLayoutY(425);
backEndscreenButton.setVisible(true); backEndscreenButton.setVisible(true);
/* Überschrift ändern */ /* Überschrift ändern */
@ -1067,7 +1073,7 @@ public class HappyBirdMain extends Application {
/* Highscore-Label (Hintergrund) formatieren und einfügen */ /* Highscore-Label (Hintergrund) formatieren und einfügen */
highscoreMenuLabel.setLayoutX(75); highscoreMenuLabel.setLayoutX(75);
highscoreMenuLabel.setLayoutY(150); highscoreMenuLabel.setLayoutY(100);
highscoreMenuLabel.setPrefSize(250, 300); highscoreMenuLabel.setPrefSize(250, 300);
endScreen.getChildren().add(highscoreMenuLabel); endScreen.getChildren().add(highscoreMenuLabel);
highscoreMenuLabel.setVisible(true); highscoreMenuLabel.setVisible(true);