Endscreen formatieren
This commit is contained in:
parent
af010b5bd8
commit
98bcfec0fd
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.
@ -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; " +
|
||||
|
@ -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<Rectangle> pipesArrayList = new ArrayList<Rectangle>();
|
||||
private final ArrayList<Rectangle> pipesToRemove = new ArrayList<Rectangle>();
|
||||
|
||||
/*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();
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user