Auslagerung SpielGameButton
This commit is contained in:
parent
70c8716a5f
commit
082839ae86
@ -48,6 +48,13 @@ public class HappyBirdMain extends Application {
|
|||||||
|
|
||||||
private Slider soundSlider = new Slider();
|
private Slider soundSlider = new Slider();
|
||||||
|
|
||||||
|
private Image bird = new Image("file:src/main/resources/com/example/happy_bird/pics/bird.png", 50, 35, false, false);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
launch(args);
|
launch(args);
|
||||||
}
|
}
|
||||||
@ -62,8 +69,8 @@ public class HappyBirdMain extends Application {
|
|||||||
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/Background.png");
|
||||||
|
|
||||||
/**Hintergrund erstellen:*/
|
/**Hintergrund erstellen:*/
|
||||||
BackgroundImage backgroundImageImg = new BackgroundImage(
|
BackgroundImage backgroundImage = new BackgroundImage(
|
||||||
backgroundImage,
|
image,
|
||||||
BackgroundRepeat.NO_REPEAT,
|
BackgroundRepeat.NO_REPEAT,
|
||||||
BackgroundRepeat.NO_REPEAT,
|
BackgroundRepeat.NO_REPEAT,
|
||||||
BackgroundPosition.DEFAULT,
|
BackgroundPosition.DEFAULT,
|
||||||
@ -71,19 +78,7 @@ public class HappyBirdMain extends Application {
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**Hintergrund zu Pane hinzufügen:*/
|
/**Hintergrund zu Pane hinzufügen:*/
|
||||||
Image bird = new Image("file:src/main/resources/com/example/happy_bird/pics/bird.png", 50, 35, false, false);
|
Background background = new Background(backgroundImage);
|
||||||
/*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);
|
|
||||||
|
|
||||||
Background background = new Background(backgroundImageImg);
|
|
||||||
pane.setBackground(background);
|
pane.setBackground(background);
|
||||||
|
|
||||||
|
|
||||||
@ -297,31 +292,8 @@ public class HappyBirdMain extends Application {
|
|||||||
*/
|
*/
|
||||||
public void startButtonClick() {
|
public void startButtonClick() {
|
||||||
headline.setText("START");
|
headline.setText("START");
|
||||||
startGame.setOnAction(event -> {
|
startGameButton.setOnAction(event -> {
|
||||||
for(TextField feld : inputFields) {
|
startGameButtonClick();
|
||||||
feld.setVisible(false);
|
|
||||||
}
|
|
||||||
for (Label label : startLabels )
|
|
||||||
{
|
|
||||||
label.setVisible(false);
|
|
||||||
}
|
|
||||||
startGame.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);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
for(Button button : buttons) {
|
for(Button button : buttons) {
|
||||||
@ -389,4 +361,34 @@ public class HappyBirdMain extends Application {
|
|||||||
label.setVisible(false);
|
label.setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Startet Spiel nach Namenseingabe
|
||||||
|
*/
|
||||||
|
public void startGameButtonClick() {
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user