Highscore/Score-Labels und Kürzel im Spiel

This commit is contained in:
Mats Pape 2021-11-29 13:57:03 +01:00
parent 3f7137b449
commit 6712042c42
10 changed files with 18 additions and 48 deletions

View File

@ -29,8 +29,9 @@ public class HappyBirdMain extends Application {
private Label acronymLabel = new Label("KÜRZEL");
private Label headline = new Label("HAPPY BIRD");
private Label soundLabel = new Label("SOUND");
private Label labels[] = {nameLabel, acronymLabel, soundLabel};
private Label currentScoreLabel = new Label("SCORE");
private Label highscoreLabel = new Label("HIGHSCORE");
private Label labels[] = {nameLabel, acronymLabel, soundLabel, currentScoreLabel, highscoreLabel};
private Label headlineLabels[] = {headline};
private Button startButton = new Button("START");
@ -78,21 +79,6 @@ public class HappyBirdMain extends Application {
);
/**Hintergrund zu Pane hinzufügen:*/
<<<<<<< HEAD
Image bird = new Image("file:src/main/resources/com/example/happy_bird/pics/bird.png", 50, 35, false, false);
/*ImageView birdView = new ImageView();
birdView.setFitHeight(50);
birdView.setFitWidth(50);
birdView.setLayoutX(50);
birdView.setLayoutY(325);
*/
Image upperPipe = new Image("file:src/main/resources/com/example/happy_bird/pics/PipeOben.png", 86, 300, false, false);
Image lowerPipe = new Image("file:src/main/resources/com/example/happy_bird/pics/PipeUnten.png", 86, 300, false, false);
=======
>>>>>>> 082839ae867a23cdf54af575f5daed906e6a0b6f
Background background = new Background(backgroundImage);
pane.setBackground(background);
@ -308,55 +294,28 @@ public class HappyBirdMain extends Application {
public void startButtonClick() {
headline.setText("START");
startGameButton.setOnAction(event -> {
<<<<<<< HEAD
for(TextField feld : inputFields) {
feld.setVisible(false);
}
for (Label label : labels )
{
label.setVisible(false);
}
startGameButton.setVisible(false);
menuButton.setVisible(false);
headline.setVisible(false);
ImageView birdView = new ImageView(bird);
pane.getChildren().add(birdView);
birdView.setLayoutY(325);
birdView.setLayoutX(50);
ImageView upperPipeView = new ImageView(upperPipe);
pane.getChildren().add(upperPipeView);
upperPipeView.setLayoutX(400);
upperPipeView.setLayoutY(0);
ImageView lowerPipeView = new ImageView(lowerPipe);
pane.getChildren().add(lowerPipeView);
lowerPipeView.setLayoutX(400);
lowerPipeView.setLayoutY(430);
=======
startGameButtonClick();
>>>>>>> 082839ae867a23cdf54af575f5daed906e6a0b6f
});
for(Button button : buttons) {
button.setVisible(false);
}
startGameButton.setVisible(true);
menuButton.setVisible(true);
startGameButton.setLayoutY(520);
for(TextField feld : inputFields) {
feld.setVisible(true);
}
for (Label label : labels ) {
label.setVisible(true);
}
highscoreLabel.setVisible(false);
currentScoreLabel.setVisible(false);
soundLabel.setVisible(false);
}
/***
* Hauptmenü wird ausgeblendet, Einstellungen folgen
*/
@ -408,6 +367,7 @@ public class HappyBirdMain extends Application {
* Startet Spiel nach Namenseingabe
*/
public void startGameButtonClick() {
nameLabel.setText("NAME: " + acronym.getText());
for(TextField feld : inputFields) {
feld.setVisible(false);
}
@ -422,6 +382,9 @@ public class HappyBirdMain extends Application {
pane.getChildren().add(birdView);
birdView.setLayoutY(325);
birdView.setLayoutX(50);
nameLabel.setLayoutX(10);
nameLabel.setLayoutY(10);
nameLabel.setVisible(true);
ImageView upperPipeView = new ImageView(upperPipe);
pane.getChildren().add(upperPipeView);
@ -432,5 +395,12 @@ public class HappyBirdMain extends Application {
pane.getChildren().add(lowerPipeView);
lowerPipeView.setLayoutX(400);
lowerPipeView.setLayoutY(430);
currentScoreLabel.setLayoutX(540);
currentScoreLabel.setLayoutY(10);
currentScoreLabel.setVisible(true);
highscoreLabel.setLayoutX(540);
highscoreLabel.setLayoutY(70);
highscoreLabel.setVisible(true);
}
}