Compare commits
2 Commits
e2e726adfb
...
7f359cb01f
Author | SHA1 | Date | |
---|---|---|---|
7f359cb01f | |||
4f9de09893 |
Happy_Bird
.gradle
7.1.1
buildOutputCleanup
checksums
build
classes/java/main/com/example/happy_bird
libs
resources/main/com/example/happy_bird/pics
tmp/compileJava
src/main
java/com/example/happy_bird
resources/com/example/happy_bird/pics
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.
Binary file not shown.
Binary file not shown.
Before ![]() (image error) Size: 114 KiB After ![]() (image error) Size: 114 KiB ![]() ![]() |
Binary file not shown.
After ![]() (image error) Size: 14 KiB |
Binary file not shown.
After ![]() (image error) Size: 54 KiB |
Binary file not shown.
After ![]() (image error) Size: 5.5 KiB |
Binary file not shown.
@ -49,10 +49,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();
|
||||
@ -113,7 +116,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(
|
||||
@ -177,6 +180,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);
|
||||
|
||||
@ -277,6 +287,53 @@ public class HappyBirdMain extends Application {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void backgroundButtonsFormating() {
|
||||
|
||||
int xPosition = 150;
|
||||
|
||||
for(int i=0; i<backgroundButtons.length; i++) {
|
||||
backgroundButtons[i].setPrefSize(200, 175);
|
||||
backgroundButtons[i].setLayoutY(400);
|
||||
backgroundButtons[i].setLayoutX(xPosition);
|
||||
xPosition += 300;
|
||||
|
||||
/*Bild für Hintergrund erstellen:*/
|
||||
Image image = new Image("file:src/main/resources/com/example/happy_bird/pics/Background"+i+"button.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);
|
||||
|
||||
backgroundButtons[i].setBackground(background);
|
||||
|
||||
backgroundButtons[i].setStyle("-fx-border-width: 7px;" +
|
||||
"-fx-border-insets: -7;" +
|
||||
"-fx-border-color: #FFFFFF;" +
|
||||
"-fx-border-radius: 15px;");
|
||||
|
||||
pane.getChildren().add(backgroundButtons[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
for(Button button : backgroundButtons) {
|
||||
button.setPrefSize(200,150);
|
||||
button.setLayoutY(400);
|
||||
button.setLayoutX(xPosition);
|
||||
xPosition += 300;
|
||||
|
||||
pane.getChildren().add(button);
|
||||
}*/
|
||||
}
|
||||
|
||||
/***
|
||||
* Formatiert alle kleinen Labels (keine Überschrift) und fügt sie der Pane hinzu
|
||||
* @param labels LabelArray mit allen Labels
|
||||
@ -444,6 +501,46 @@ public class HappyBirdMain extends Application {
|
||||
menuButton.setVisible(true);
|
||||
soundSlider.setVisible(true);
|
||||
soundLabel.setVisible(true);
|
||||
|
||||
background1.setVisible(true);
|
||||
background2.setVisible(true);
|
||||
|
||||
|
||||
background1.setOnAction(event -> {
|
||||
/*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);
|
||||
});
|
||||
}
|
||||
|
||||
/***
|
||||
@ -517,6 +614,9 @@ public class HappyBirdMain extends Application {
|
||||
menuButton.setVisible(false);
|
||||
startGameButton.setVisible(false);
|
||||
|
||||
background1.setVisible(false);
|
||||
background2.setVisible(false);
|
||||
|
||||
/*soundSlider ausblenden*/
|
||||
soundSlider.setVisible(false);
|
||||
|
||||
|
Before ![]() (image error) Size: 114 KiB After ![]() (image error) Size: 114 KiB ![]() ![]() |
Binary file not shown.
After ![]() (image error) Size: 14 KiB |
Binary file not shown.
After ![]() (image error) Size: 54 KiB |
Binary file not shown.
After ![]() (image error) Size: 5.5 KiB |
Loading…
x
Reference in New Issue
Block a user