Compare commits
No commits in common. "4f2eeb5040d8079e5a1cc010d19611107abd5141" and "d835ec3460b7a78ed6a95e32172b60b5dbdbaa2a" have entirely different histories.
4f2eeb5040
...
d835ec3460
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.
2
Happy_Bird/.idea/Happy_Bird.iml
generated
Normal file
2
Happy_Bird/.idea/Happy_Bird.iml
generated
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4" />
|
5
Happy_Bird/.idea/compiler.xml
generated
5
Happy_Bird/.idea/compiler.xml
generated
@ -3,9 +3,4 @@
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="15" />
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||
<module name="Happy_Bird.main" options="--add-exports java.base/jdk.internal.module=com.example.happy_bird" />
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
10
Happy_Bird/.idea/runConfigurations.xml
generated
Normal file
10
Happy_Bird/.idea/runConfigurations.xml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 6.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 6.5 KiB |
Binary file not shown.
@ -9,7 +9,6 @@ import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.scene.paint.ImagePattern;
|
||||
import javafx.stage.Stage;
|
||||
@ -22,9 +21,6 @@ import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class HappyBirdMain extends Application {
|
||||
|
||||
private float velocity = 0f;
|
||||
private float gravity = 0.25f;
|
||||
private int birdPositionMovedBy = 0;
|
||||
private int collectedPoints;
|
||||
private int playerhighscore;
|
||||
@ -103,7 +99,8 @@ 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");
|
||||
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");
|
||||
@ -411,7 +408,7 @@ public class HappyBirdMain extends Application {
|
||||
|
||||
|
||||
/*Timeline: alle 2 Sekunden spawnt eine neue Pipe am rechten Rand*/
|
||||
timeline = new Timeline(new KeyFrame(Duration.seconds(1.5), e ->{
|
||||
timeline = new Timeline(new KeyFrame(Duration.seconds(2), e ->{
|
||||
/*Pipes erstellen*/
|
||||
Rectangle[] pipesTopBottom = createPipes();
|
||||
|
||||
@ -508,7 +505,6 @@ public class HappyBirdMain extends Application {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* Hauptmenü wird ausgeblendet, Nameneingabe folgt
|
||||
*/
|
||||
@ -695,33 +691,21 @@ public class HappyBirdMain extends Application {
|
||||
}
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent e) {
|
||||
scene.setOnKeyPressed(event -> {
|
||||
if (event.getCode() == KeyCode.W) {
|
||||
moveBirdUp();
|
||||
}
|
||||
|
||||
if (event.getCode() == KeyCode.S) {
|
||||
moveBirdDown();
|
||||
}
|
||||
});
|
||||
};
|
||||
/***
|
||||
* Startet Spiel nach Namenseingabe
|
||||
*/
|
||||
|
||||
public void startGameButtonClick() {
|
||||
if (correctName() == 0 && correctAcronym() == 0)
|
||||
{
|
||||
generateGameScreen();
|
||||
System.out.println(this.gameRunning);
|
||||
System.out.println(gameRunning);
|
||||
pauseButton.setDefaultButton(false);
|
||||
|
||||
/*Klick auf den Pause-Button, um das Pause-Menü aufzurufen*/
|
||||
pauseButton.setOnAction(event -> {
|
||||
if (!menuScreenRunning) {
|
||||
pauseButtonClick(this.gameRunning);
|
||||
this.gameRunning = !this.gameRunning;
|
||||
pauseButtonClick(gameRunning);
|
||||
gameRunning = !gameRunning;
|
||||
}
|
||||
});
|
||||
|
||||
@ -733,36 +717,20 @@ public class HappyBirdMain extends Application {
|
||||
*/
|
||||
birdPositionMovedBy = 0;
|
||||
scene.setOnKeyPressed(event -> {
|
||||
/*if (event.getCode() == KeyCode.S) {
|
||||
moveBirdDown();
|
||||
System.out.println(birdPositionMovedBy);
|
||||
}*/
|
||||
|
||||
|
||||
// FUNKTIONIERT
|
||||
// aktuelle birdPositionMovedBy rausfid
|
||||
|
||||
|
||||
/*if (event.getCode() == KeyCode.W) {
|
||||
moveBirdUp();
|
||||
}
|
||||
if (event.getCode() == KeyCode.S) {
|
||||
moveBirdDown();
|
||||
}*/
|
||||
|
||||
System.out.println(birdPositionMovedBy);
|
||||
}
|
||||
if (event.getCode() == KeyCode.W) {
|
||||
moveBirdUp();
|
||||
}
|
||||
else {
|
||||
moveBirdDown();
|
||||
System.out.println(birdPositionMovedBy);
|
||||
}
|
||||
if (event.getCode() == KeyCode.ESCAPE && !menuScreenRunning) {
|
||||
pauseButtonClick(this.gameRunning);
|
||||
this.gameRunning = !this.gameRunning;
|
||||
pauseButtonClick(gameRunning);
|
||||
gameRunning = !gameRunning;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
checkNameLabel.setVisible(false);
|
||||
checkAcronymLabel.setVisible(false);
|
||||
@ -1200,16 +1168,12 @@ public class HappyBirdMain extends Application {
|
||||
}
|
||||
|
||||
private void moveBirdUp() {
|
||||
velocity = (float) -4.5;
|
||||
var pos = velocity += gravity;
|
||||
birdPositionMovedBy += pos;
|
||||
birdPositionMovedBy = birdPositionMovedBy - 10;
|
||||
happyBird.setLayoutY(birdPositionMovedBy);
|
||||
}
|
||||
|
||||
// Soll Automatisch runter fallen
|
||||
private void moveBirdDown() {
|
||||
var pos = velocity -= gravity;
|
||||
birdPositionMovedBy -= pos;
|
||||
birdPositionMovedBy = birdPositionMovedBy + 10;
|
||||
happyBird.setLayoutY(birdPositionMovedBy);
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 6.5 KiB |
Loading…
x
Reference in New Issue
Block a user