diff --git a/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin b/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin index e9b7418..cc659a6 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 a4e68c4..0ee8464 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 85bdbf6..9b0e9f2 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 2367c58..0e005d0 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 6da2fff..731b97e 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 ab916e9..0272879 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 dd23200..713fdf0 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/pics/Background.png b/Happy_Bird/build/resources/main/com/example/happy_bird/pics/Background0.png similarity index 100% rename from Happy_Bird/build/resources/main/com/example/happy_bird/pics/Background.png rename to Happy_Bird/build/resources/main/com/example/happy_bird/pics/Background0.png diff --git a/Happy_Bird/build/resources/main/com/example/happy_bird/pics/Background0button.png b/Happy_Bird/build/resources/main/com/example/happy_bird/pics/Background0button.png new file mode 100644 index 0000000..8d7c655 Binary files /dev/null and b/Happy_Bird/build/resources/main/com/example/happy_bird/pics/Background0button.png differ diff --git a/Happy_Bird/build/resources/main/com/example/happy_bird/pics/Background1.png b/Happy_Bird/build/resources/main/com/example/happy_bird/pics/Background1.png new file mode 100644 index 0000000..ed9fca1 Binary files /dev/null and b/Happy_Bird/build/resources/main/com/example/happy_bird/pics/Background1.png differ diff --git a/Happy_Bird/build/resources/main/com/example/happy_bird/pics/Background1button.png b/Happy_Bird/build/resources/main/com/example/happy_bird/pics/Background1button.png new file mode 100644 index 0000000..d64c32d Binary files /dev/null and b/Happy_Bird/build/resources/main/com/example/happy_bird/pics/Background1button.png differ diff --git a/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin b/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin index a270af8..99dbf14 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/HappyBirdMain.java b/Happy_Bird/src/main/java/com/example/happy_bird/HappyBirdMain.java index 46d7273..66d1467 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 @@ -47,10 +47,13 @@ public class HappyBirdMain extends Application { private final Button settingsButtonPause = new Button("EINSTELLUNGEN"); private final Button menuButtonPause = new Button("HAUPTMENÜ"); private final Button backButtonPause = new Button("ZURÜCK"); + private final Button background1 = new Button(); + private final Button background2 = new Button(); /*Buttons in Arrays speichern*/ private final Button[] buttons = {startButton, highscoresButton, settingsButton, startGameButton, menuButton, pauseButton, continueButton, settingsButtonPause, menuButtonPause, backButtonPause}; private final Button[] pauseButtons = {continueButton, settingsButtonPause, menuButtonPause, backButtonPause}; + private final Button[] backgroundButtons = {background1, background2}; /*Textfelder erstellen und zuweisen*/ private final TextField name = new TextField(); @@ -111,7 +114,7 @@ public class HappyBirdMain extends Application { menuScreenRunning = true; /*Bild für Hintergrund erstellen:*/ - Image image = new Image("file:src/main/resources/com/example/happy_bird/pics/Background.png"); + Image image = new Image("file:src/main/resources/com/example/happy_bird/pics/Background0.png"); /*Hintergrund erstellen:*/ BackgroundImage backgroundImage = new BackgroundImage( @@ -175,6 +178,13 @@ public class HappyBirdMain extends Application { /*settingsButtonPause unsichtbar*/ settingsButtonPause.setVisible(false); + /*Buttons für Hintergründe*/ + backgroundButtonsFormating(); + + /*Background-Buttons unsichtbar*/ + background1.setVisible(false); + background2.setVisible(false); + /*Textfelder formatieren:*/ textfieldsFormating(inputFields, pane); @@ -275,6 +285,53 @@ public class HappyBirdMain extends Application { } } + + public void backgroundButtonsFormating() { + + int xPosition = 150; + + for(int i=0; i { + /*Bild für Hintergrund erstellen:*/ + Image image = new Image("file:src/main/resources/com/example/happy_bird/pics/Background0.png"); + + /*Hintergrund erstellen:*/ + BackgroundImage backgroundImage = new BackgroundImage( + image, + BackgroundRepeat.NO_REPEAT, + BackgroundRepeat.NO_REPEAT, + BackgroundPosition.DEFAULT, + BackgroundSize.DEFAULT + ); + + /*Hintergrund zu Pane hinzufügen:*/ + Background background = new Background(backgroundImage); + pane.setBackground(background); + }); + + background2.setOnAction(event -> { + /*Bild für Hintergrund erstellen:*/ + Image image = new Image("file:src/main/resources/com/example/happy_bird/pics/Background1.png"); + + /*Hintergrund erstellen:*/ + BackgroundImage backgroundImage = new BackgroundImage( + image, + BackgroundRepeat.NO_REPEAT, + BackgroundRepeat.NO_REPEAT, + BackgroundPosition.DEFAULT, + BackgroundSize.DEFAULT + ); + + /*Hintergrund zu Pane hinzufügen:*/ + Background background = new Background(backgroundImage); + pane.setBackground(background); + }); } /*** @@ -515,6 +612,9 @@ public class HappyBirdMain extends Application { menuButton.setVisible(false); startGameButton.setVisible(false); + background1.setVisible(false); + background2.setVisible(false); + /*soundSlider ausblenden*/ soundSlider.setVisible(false); diff --git a/Happy_Bird/src/main/resources/com/example/happy_bird/pics/Background.png b/Happy_Bird/src/main/resources/com/example/happy_bird/pics/Background0.png similarity index 100% rename from Happy_Bird/src/main/resources/com/example/happy_bird/pics/Background.png rename to Happy_Bird/src/main/resources/com/example/happy_bird/pics/Background0.png diff --git a/Happy_Bird/src/main/resources/com/example/happy_bird/pics/Background0button.png b/Happy_Bird/src/main/resources/com/example/happy_bird/pics/Background0button.png new file mode 100644 index 0000000..8d7c655 Binary files /dev/null and b/Happy_Bird/src/main/resources/com/example/happy_bird/pics/Background0button.png differ diff --git a/Happy_Bird/src/main/resources/com/example/happy_bird/pics/Background1.png b/Happy_Bird/src/main/resources/com/example/happy_bird/pics/Background1.png new file mode 100644 index 0000000..ed9fca1 Binary files /dev/null and b/Happy_Bird/src/main/resources/com/example/happy_bird/pics/Background1.png differ diff --git a/Happy_Bird/src/main/resources/com/example/happy_bird/pics/Background1button.png b/Happy_Bird/src/main/resources/com/example/happy_bird/pics/Background1button.png new file mode 100644 index 0000000..d64c32d Binary files /dev/null and b/Happy_Bird/src/main/resources/com/example/happy_bird/pics/Background1button.png differ