Zusammenführung von Methoden
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 6.5 KiB  | 
@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					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;
 | 
				
			||||||
 | 
					import javafx.scene.control.TextField;
 | 
				
			||||||
 | 
					import javafx.scene.control.Slider;
 | 
				
			||||||
 | 
					import javafx.scene.image.*;
 | 
				
			||||||
 | 
					import javafx.scene.image.Image;
 | 
				
			||||||
 | 
					import javafx.scene.layout.*;
 | 
				
			||||||
 | 
					import javafx.scene.text.TextAlignment;
 | 
				
			||||||
 | 
					import javafx.stage.Stage;
 | 
				
			||||||
 | 
					import java.awt.*;
 | 
				
			||||||
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class GameScreen extends HappyBirdMain
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -63,7 +63,7 @@ public class HappyBirdMain extends Application {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        /**Hintergrund erstellen:*/
 | 
					        /**Hintergrund erstellen:*/
 | 
				
			||||||
        BackgroundImage backgroundImageImg = new BackgroundImage(
 | 
					        BackgroundImage backgroundImageImg = new BackgroundImage(
 | 
				
			||||||
                image,
 | 
					                backgroundImage,
 | 
				
			||||||
                BackgroundRepeat.NO_REPEAT,
 | 
					                BackgroundRepeat.NO_REPEAT,
 | 
				
			||||||
                BackgroundRepeat.NO_REPEAT,
 | 
					                BackgroundRepeat.NO_REPEAT,
 | 
				
			||||||
                BackgroundPosition.DEFAULT,
 | 
					                BackgroundPosition.DEFAULT,
 | 
				
			||||||
@@ -71,6 +71,18 @@ 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);
 | 
				
			||||||
 | 
					        /*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);
 | 
					        Background background = new Background(backgroundImageImg);
 | 
				
			||||||
        pane.setBackground(background);
 | 
					        pane.setBackground(background);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -285,6 +297,32 @@ public class HappyBirdMain extends Application {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public void startButtonClick() {
 | 
					    public void startButtonClick() {
 | 
				
			||||||
        headline.setText("START");
 | 
					        headline.setText("START");
 | 
				
			||||||
 | 
					        startGame.setOnAction(event ->  {
 | 
				
			||||||
 | 
					            for(TextField feld : inputFields) {
 | 
				
			||||||
 | 
					                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) {
 | 
				
			||||||
            button.setVisible(false);
 | 
					            button.setVisible(false);
 | 
				
			||||||
 
 | 
				
			|||||||
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 6.5 KiB  | 
		Reference in New Issue
	
	Block a user