z-Order im Spielscreen

This commit is contained in:
Lars Alteköster 2022-01-24 12:00:13 +01:00
parent e818be6c17
commit 241bd0f85b
9 changed files with 5 additions and 8 deletions

View File

@ -95,7 +95,7 @@ public class HappyBirdMain extends Application {
private final Slider soundSliderPause = new Slider();
/*Bilder*/
private final Image bird = new Image("file:src/main/resources/com/example/happy_bird/pics/bird.png", 50, 35, false, false);
private final Image bird = new Image("file:src/main/resources/com/example/happy_bird/pics/bird.png", 45, 30, false, false);
private final Image pipeTop = new Image("file:src/main/resources/com/example/happy_bird/pics/PipeTop.png");
private final Image pipeBottom = new Image("file:src/main/resources/com/example/happy_bird/pics/PipeBottom.png");
@ -109,16 +109,13 @@ public class HappyBirdMain extends Application {
private TranslateTransition top;
private TranslateTransition bottom;
private TranslateTransition birdTransition;
private Timeline timeline;
private final ArrayList<Transition> transitions = new ArrayList<Transition>();;
public static void main(String[] args) {
launch(args);
}
@Override
@ -141,7 +138,6 @@ public class HappyBirdMain extends Application {
startGameButtonClick();
});
stage.show();
}
@ -159,17 +155,18 @@ public class HappyBirdMain extends Application {
Rectangle topPipe = new Rectangle(900, y, 91, 500);
/* Pipe unten; spawnt auf der gleichen Höhe wie obere Pipe
* +400, da y-Koord die untere linke Ecke ist
* +250, der Abstand zwischen oberer Pipe und unterer Pipe */
* +400 +250, für Abstand zwischen oberer Pipe und unterer Pipe */
Rectangle bottomPipe = new Rectangle(900, y + 400 + 250, 91, 500);
/* oberer Pipe ein Hintergrundbild geben */
Image img = new Image("file:src/main/resources/com/example/happy_bird/pics/PipeTop.png");
topPipe.setFill(new ImagePattern(pipeTop));
topPipe.setStyle("-fx-view-order: 1");
/* unterer Pipe ein Hintergrundbild geben */
img = new Image("file:src/main/resources/com/example/happy_bird/pics/PipeBottom.png");
bottomPipe.setFill(new ImagePattern(pipeBottom));
bottomPipe.setStyle("-fx-view-order: 1");
/* neue Animationen über TranslateTransitions */
top = new TranslateTransition();