Code Cleaning

This commit is contained in:
Gregor Bickmann 2022-02-10 08:47:16 +01:00
parent 4f2eeb5040
commit 88b0ba5d05
10 changed files with 7 additions and 21 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

View File

@ -733,29 +733,14 @@ 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();
}*/
if (event.getCode() == KeyCode.W) {
moveBirdUp();
}
else {
if (event.getCode() == KeyCode.S) {
moveBirdDown();
}
if (event.getCode() == KeyCode.ESCAPE && !menuScreenRunning) {
pauseButtonClick(this.gameRunning);
this.gameRunning = !this.gameRunning;
@ -1199,6 +1184,7 @@ public class HappyBirdMain extends Application {
generateMenueScreen();
}
// Aufstieg dauert immer länger
private void moveBirdUp() {
velocity = (float) -4.5;
var pos = velocity += gravity;
@ -1206,7 +1192,7 @@ public class HappyBirdMain extends Application {
happyBird.setLayoutY(birdPositionMovedBy);
}
// Soll Automatisch runter fallen
// Fall geht schneller
private void moveBirdDown() {
var pos = velocity -= gravity;
birdPositionMovedBy -= pos;