diff --git a/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin b/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin
index edf536f..3ec5b8d 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 691fa9b..3d83a6b 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 0be605b..f93e2b7 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 8aca6be..6abfaca 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 ee5ab2a..44aa942 100644
Binary files a/Happy_Bird/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/Happy_Bird/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ
diff --git a/Happy_Bird/.gradle/buildOutputCleanup/outputFiles.bin b/Happy_Bird/.gradle/buildOutputCleanup/outputFiles.bin
index e70d231..e24dad9 100644
Binary files a/Happy_Bird/.gradle/buildOutputCleanup/outputFiles.bin and b/Happy_Bird/.gradle/buildOutputCleanup/outputFiles.bin differ
diff --git a/Happy_Bird/.gradle/checksums/checksums.lock b/Happy_Bird/.gradle/checksums/checksums.lock
index 3d09054..1f8032a 100644
Binary files a/Happy_Bird/.gradle/checksums/checksums.lock and b/Happy_Bird/.gradle/checksums/checksums.lock differ
diff --git a/Happy_Bird/.gradle/checksums/md5-checksums.bin b/Happy_Bird/.gradle/checksums/md5-checksums.bin
index 9ab4f60..4f2a956 100644
Binary files a/Happy_Bird/.gradle/checksums/md5-checksums.bin and b/Happy_Bird/.gradle/checksums/md5-checksums.bin differ
diff --git a/Happy_Bird/.gradle/checksums/sha1-checksums.bin b/Happy_Bird/.gradle/checksums/sha1-checksums.bin
index 6fd3626..4bf74b2 100644
Binary files a/Happy_Bird/.gradle/checksums/sha1-checksums.bin and b/Happy_Bird/.gradle/checksums/sha1-checksums.bin differ
diff --git a/Happy_Bird/.idea/.name b/Happy_Bird/.idea/.name
index dbea456..dd712e9 100644
--- a/Happy_Bird/.idea/.name
+++ b/Happy_Bird/.idea/.name
@@ -1 +1 @@
-HappyBird.java
\ No newline at end of file
+HappyBirdMain.java
\ No newline at end of file
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 6029a1c..288b295 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 6615e7d..b1b108e 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/resources/main/com/example/happy_bird/happyBird.fxml b/Happy_Bird/build/resources/main/com/example/happy_bird/happyBird.fxml
index 2301392..ac1c9d6 100644
--- a/Happy_Bird/build/resources/main/com/example/happy_bird/happyBird.fxml
+++ b/Happy_Bird/build/resources/main/com/example/happy_bird/happyBird.fxml
@@ -7,13 +7,10 @@
-<<<<<<< HEAD
-=======
->>>>>>> 5db5b6bb195a2b7d1296e7d3f9b98d6c75dba2c2
diff --git a/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin b/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin
index d96eb5f..e386013 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/Bird.java b/Happy_Bird/src/main/java/com/example/happy_bird/Bird.java
new file mode 100644
index 0000000..2a00776
--- /dev/null
+++ b/Happy_Bird/src/main/java/com/example/happy_bird/Bird.java
@@ -0,0 +1,21 @@
+package com.example.happy_bird;
+
+import java.awt.*;
+import java.awt.image.ImageObserver;
+
+public class Bird extends SpielObjekt {
+
+ public Bird(int xWert, int yWert) {
+ super(xWert, yWert);
+ }
+
+ @Override
+ public void tick() {
+
+ }
+
+ @Override
+ public void render(Graphics2D g, ImageObserver obs) {
+
+ }
+}
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 65ce4c7..c76ceb8 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
@@ -1,11 +1,6 @@
package com.example.happy_bird;
import javafx.application.Application;
-import javafx.event.ActionEvent;
-import javafx.event.EventHandler;
-import javafx.fxml.FXMLLoader;
-import javafx.geometry.Insets;
-import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
@@ -13,11 +8,12 @@ import javafx.scene.control.TextField;
import javafx.scene.control.Slider;
import javafx.scene.image.*;
import javafx.scene.image.Image;
+import javafx.scene.input.KeyCode;
import javafx.scene.layout.*;
import javafx.scene.text.TextAlignment;
import javafx.stage.Stage;
-import java.awt.*;
+
import java.io.IOException;
public class HappyBirdMain extends Application {
@@ -31,6 +27,7 @@ public class HappyBirdMain extends Application {
private Label soundLabel = new Label("SOUND");
private Label currentScoreLabel = new Label("SCORE");
private Label highscoreLabel = new Label("HIGHSCORE");
+ private Label pauseMenu = new Label("Pause");
private Label labels[] = {nameLabel, acronymLabel, soundLabel, currentScoreLabel, highscoreLabel};
private Label headlineLabels[] = {headline};
@@ -39,8 +36,10 @@ public class HappyBirdMain extends Application {
private Button settingsButton = new Button("EINSTELLUNGEN");
private Button startGameButton = new Button("SPIEL STARTEN");
private Button menuButton = new Button("ZURÜCK");
+ private Button pauseButton = new Button("PAUSE");
+ private Button continueButton = new Button("WEITERSPIELEN");
- private Button[] buttons = {startButton, highscoresButton, settingsButton, startGameButton, menuButton};
+ private Button[] buttons = {startButton, highscoresButton, settingsButton, startGameButton, menuButton, pauseButton, continueButton};
private TextField name = new TextField();
private TextField acronym = new TextField();
@@ -54,6 +53,10 @@ public class HappyBirdMain extends Application {
private Image upperPipe = new Image("file:src/main/resources/com/example/happy_bird/pics/PipeOben.png", 86, 300, false, false);
private Image lowerPipe = new Image("file:src/main/resources/com/example/happy_bird/pics/PipeUnten.png", 86, 300, false, false);
+ private Pane pause = new Pane();
+
+ private boolean gameRuns;
+
public static void main(String[] args) {
@@ -66,6 +69,39 @@ public class HappyBirdMain extends Application {
stage.setTitle("Happy Bird");
stage.setScene(scene);
+ generateMenueScene();
+
+ gameRuns = false;
+
+ /**ClickEvents:*/
+ startButton.setOnAction(event -> {
+ startButtonClick();
+ });
+
+ settingsButton.setOnAction(event -> {
+ settingsButtonClick();
+ });
+
+ highscoresButton.setOnAction(event -> {
+ highscoresButtonClick();
+ });
+
+ menuButton.setOnAction(event -> {
+ menuButtonClick();
+ });
+
+ startGameButton.setOnAction(event -> {
+ gameRuns = true;
+ startGameButtonClick();
+ });
+
+
+
+ stage.show();
+ }
+
+
+ public void generateMenueScene() {
/**Bild für Hintergrund erstellen:*/
Image image = new Image("file:src/main/resources/com/example/happy_bird/pics/Background.png");
@@ -85,6 +121,12 @@ public class HappyBirdMain extends Application {
/**Labels erstellen:*/
+ //nameLabel = new Label("NAME");
+ //acronymLabel = new Label("KÜRZEL");
+ //headline = new Label("HAPPY BIRD");
+ //soundLabel = new Label("SOUND");
+ //currentScoreLabel = new Label("SCORE");
+ //highscoreLabel = new Label("HIGHSCORE");
/**Labels in Arrays speichern:*/
@@ -112,7 +154,11 @@ public class HappyBirdMain extends Application {
/**Buttons erstellen:*/
-
+ //startButton = new Button("START");
+ //highscoresButton = new Button("HIGHSCORES");
+ //settingsButton = new Button("EINSTELLUNGEN");
+ //startGameButton = new Button("SPIEL STARTEN");
+ //menuButton = new Button("ZURÜCK");
/**Buttons in Array speichern:*/
@@ -136,10 +182,14 @@ public class HappyBirdMain extends Application {
/**startGameButton unsichtbar*/
startGameButton.setVisible(false);
+ /**continueButton unsichtbar*/
+ continueButton.setVisible(false);
+
/**Textfelder erstellen:*/
-
+ //name = new TextField();
+ //acronym = new TextField();
/**Textfelder in Array speichern:*/
@@ -158,31 +208,71 @@ public class HappyBirdMain extends Application {
/**SoundSlider erstellen:*/
-
+ //soundSlider = new Slider();
/**SoundSlicer anpassen:*/
soundSliderFormating(soundSlider, pane);
+ }
+ /**
+ * Generiert den GameScreen durch Ausblenden und
+ * Sichtbarmachen der richtigen Buttons, Labels, ...
+ */
+ public void generateGameScreen() {
+ /**Headline-Label umbenennen*/
+ nameLabel.setText("NAME: " + acronym.getText());
- /**ClickEvents:*/
- startButton.setOnAction(event -> {
- startButtonClick();
- });
+ /**Textfelder ausblenden*/
+ for(TextField feld : inputFields) {
+ feld.setVisible(false);
+ }
- settingsButton.setOnAction(event -> {
- settingsButtonClick();
- });
+ /**Labels ausblenden*/
+ for (Label label : labels )
+ {
+ label.setVisible(false);
+ }
+ headline.setVisible(false);
- highscoresButton.setOnAction(event -> {
- highscoresButtonClick();
- });
+ /**nameLabel, currentScoreLabel und highscoreLabel positionieren und sichtbar machen*/
+ nameLabel.setLayoutX(10);
+ nameLabel.setLayoutY(10);
+ nameLabel.setVisible(true);
- menuButton.setOnAction(event -> {
- menuButtonClick();
- });
+ currentScoreLabel.setLayoutX(540);
+ currentScoreLabel.setLayoutY(10);
+ currentScoreLabel.setVisible(true);
- stage.show();
+ highscoreLabel.setLayoutX(540);
+ highscoreLabel.setLayoutY(70);
+ highscoreLabel.setVisible(true);
+
+ /**Übrige Buttons ausblenden*/
+ startGameButton.setVisible(false);
+ menuButton.setVisible(false);
+
+ /**Pause-Button positionieren und sichtbar machen*/
+ pauseButton.setLayoutX(575);
+ pauseButton.setLayoutY(625);
+ pauseButton.setVisible(true);
+
+ /**Vogel hinzufügen, bisher nur als Bild*/
+ ImageView birdView = new ImageView(bird);
+ pane.getChildren().add(birdView);
+ birdView.setLayoutY(325);
+ birdView.setLayoutX(50);
+
+ /**Pipes oben, unten hinzufügen, bisher nur als Bild*/
+ 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);
}
/***
@@ -288,6 +378,20 @@ public class HappyBirdMain extends Application {
slider.setVisible(false);
}
+ /***
+ * Formatiert den PauseScreen
+ */
+ public void pauseScreenFormating() {
+ pause.setLayoutX(200);
+ pause.setLayoutY(100);
+ pause.setPrefSize(400, 500);
+ pause.setStyle("-fx-background-color: #DED894; " +
+ "-fx-border-width: 5px;" +
+ "-fx-border-color: #543847;" +
+ "-fx-border-radius: 15px;" +
+ "-fx-background-radius: 20px;");
+ }
+
/***
* Hauptmenü wird ausgeblendet, Nameneingabe folgt
*/
@@ -367,40 +471,68 @@ public class HappyBirdMain extends Application {
* Startet Spiel nach Namenseingabe
*/
public void startGameButtonClick() {
- nameLabel.setText("NAME: " + acronym.getText());
- for(TextField feld : inputFields) {
- feld.setVisible(false);
+ generateGameScreen();
+
+
+ /**Klick auf den Pause-Button, um das Pause-Menü aufzurufen*/
+ pauseButton.setOnAction(event -> {
+ //
+ if(gameRuns) {
+ gameRuns = false;
+ } else {
+ gameRuns = true;
+ }
+ pauseButtonClick(gameRuns);
+ });
+
+ /**ESC-Tast drücken, um das Pause-Menü aufzurufen*/
+ scene.setOnKeyPressed(e -> {
+ if(e.getCode() == KeyCode.ESCAPE) {
+ if(gameRuns) {
+ gameRuns = false;
+ pauseButtonClick(false);
+ } else {
+ gameRuns = true;
+ pauseButtonClick(true);
+ }
+ }
+ });
+ }
+
+ /***
+ * Ruft das Pause-Menü im Spiel auf oder blendet es wieder aus
+ */
+ public void pauseButtonClick(Boolean gameRuns) {
+ pauseScreenFormating();
+
+ /**PauseScreen aufrufen, wenn das Spiel läuft, sonst wieder ausblenden*/
+ if(gameRuns) {
+ /**PauseScreen ausblenden*/
+ pause.setVisible(true);
+ pauseButton.setVisible(false);
+ highscoresButton.setVisible(true);
+ settingsButton.setVisible(true);
+ highscoresButton.setLayoutX(100);
+ settingsButton.setLayoutX(100);
+
+ /**Zum PauseScreen hinzufügen*/
+ pause.getChildren().add(settingsButton);
+ pause.getChildren().add(highscoresButton);
+ pane.getChildren().add(pause);
+ } else {
+ /**PauseScreen aufrufen/ sichtbar machen*/
+ pause.setVisible(false);
+
+ pauseButton.setVisible(true);
+ highscoresButton.setVisible(false);
+ settingsButton.setVisible(false);
+ highscoresButton.setLayoutX(300);
+ settingsButton.setLayoutX(300);
+
+ /**Vom PauseScreen entfernen*/
+ pause.getChildren().remove(settingsButton);
+ pause.getChildren().remove(highscoresButton);
+ pane.getChildren().remove(pause);
}
- 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);
- nameLabel.setLayoutX(10);
- nameLabel.setLayoutY(10);
- nameLabel.setVisible(true);
-
- 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);
-
- currentScoreLabel.setLayoutX(540);
- currentScoreLabel.setLayoutY(10);
- currentScoreLabel.setVisible(true);
- highscoreLabel.setLayoutX(540);
- highscoreLabel.setLayoutY(70);
- highscoreLabel.setVisible(true);
}
}
diff --git a/Happy_Bird/src/main/resources/com/example/happy_bird/happyBird.fxml b/Happy_Bird/src/main/resources/com/example/happy_bird/happyBird.fxml
index 2301392..ac1c9d6 100644
--- a/Happy_Bird/src/main/resources/com/example/happy_bird/happyBird.fxml
+++ b/Happy_Bird/src/main/resources/com/example/happy_bird/happyBird.fxml
@@ -7,13 +7,10 @@
-<<<<<<< HEAD
-=======
->>>>>>> 5db5b6bb195a2b7d1296e7d3f9b98d6c75dba2c2