diff --git a/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin b/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin index 99fc0f4..85cea88 100644 Binary files a/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin and b/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.bin differ diff --git a/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.lock b/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.lock index ad2646f..4672879 100644 Binary files a/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.lock and b/Happy_Bird/.gradle/7.1.1/executionHistory/executionHistory.lock differ diff --git a/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.bin b/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.bin index f2fb296..9c63fe3 100644 Binary files a/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.bin and b/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.bin differ diff --git a/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.lock b/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.lock index e0cdbaf..7ff1fa9 100644 Binary files a/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.lock and b/Happy_Bird/.gradle/7.1.1/fileHashes/fileHashes.lock differ diff --git a/Happy_Bird/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/Happy_Bird/.gradle/buildOutputCleanup/buildOutputCleanup.lock index d929eb2..1b2e599 100644 Binary files a/Happy_Bird/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/Happy_Bird/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/Happy_Bird/build/classes/java/main/com/example/happy_bird/HappyBirdMain.class b/Happy_Bird/build/classes/java/main/com/example/happy_bird/HappyBirdMain.class index ed5ca03..2c8c8e9 100644 Binary files a/Happy_Bird/build/classes/java/main/com/example/happy_bird/HappyBirdMain.class and b/Happy_Bird/build/classes/java/main/com/example/happy_bird/HappyBirdMain.class differ diff --git a/Happy_Bird/build/libs/Happy_Bird-1.0-SNAPSHOT.jar b/Happy_Bird/build/libs/Happy_Bird-1.0-SNAPSHOT.jar index aedd588..7a8ba9a 100644 Binary files a/Happy_Bird/build/libs/Happy_Bird-1.0-SNAPSHOT.jar and b/Happy_Bird/build/libs/Happy_Bird-1.0-SNAPSHOT.jar differ diff --git a/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin b/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin index 85e6027..52a6773 100644 Binary files a/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin and b/Happy_Bird/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/Happy_Bird/src/main/java/com/example/happy_bird/HappyBirdMain.java b/Happy_Bird/src/main/java/com/example/happy_bird/HappyBirdMain.java index 5cc08ae..64961fe 100644 --- a/Happy_Bird/src/main/java/com/example/happy_bird/HappyBirdMain.java +++ b/Happy_Bird/src/main/java/com/example/happy_bird/HappyBirdMain.java @@ -21,7 +21,8 @@ import java.sql.ResultSet; import java.util.ArrayList; public class HappyBirdMain extends Application { - private int currentBirdPosition = 0; + private int birdPositionMovedBy = 0; + private int collectedPoints; /* Formatierungsklasse */ private final FormatingClass formatingClass = new FormatingClass(); @@ -44,7 +45,7 @@ public class HappyBirdMain extends Application { private final Label acronymLabel = new Label("KÜRZEL"); private final Label headline = new Label("HAPPY BIRD"); private final Label soundLabel = new Label("SOUND"); - private final Label currentScoreLabel = new Label("SCORE: "); + private final Label currentScoreLabel = new Label("SCORE: " + collectedPoints); private final Label highscoreLabel = new Label("HIGHSCORE: "); private final Label pauseMenuLabel = new Label("PAUSE"); private final Label soundLabelPause = new Label("SOUND"); @@ -464,6 +465,12 @@ public class HappyBirdMain extends Application { timeline.stop(); gameRunning = false; } + if(happyBird.getBoundsInParent().getMaxX() > pipe.getBoundsInParent().getMaxX()) { + collectedPoints++; + int pointstoset = collectedPoints / 2; + currentScoreLabel.setText("SCORE: " + pointstoset); + pipesArrayList.remove(pipe); + } } /*** @@ -668,15 +675,15 @@ public class HappyBirdMain extends Application { } }); - currentBirdPosition = 0; + birdPositionMovedBy = 0; scene.setOnKeyPressed(event -> { if (event.getCode() == KeyCode.S) { moveBirdDown(); - System.out.println(currentBirdPosition); + System.out.println(birdPositionMovedBy); } if (event.getCode() == KeyCode.W) { moveBirdUp(); - System.out.println(currentBirdPosition); + System.out.println(birdPositionMovedBy); } }); @@ -1080,12 +1087,12 @@ public class HappyBirdMain extends Application { } private void moveBirdUp() { - currentBirdPosition = currentBirdPosition - 10; - happyBird.setLayoutY(currentBirdPosition); + birdPositionMovedBy = birdPositionMovedBy - 10; + happyBird.setLayoutY(birdPositionMovedBy); } private void moveBirdDown() { - currentBirdPosition = currentBirdPosition + 10; - happyBird.setLayoutY(currentBirdPosition); + birdPositionMovedBy = birdPositionMovedBy + 10; + happyBird.setLayoutY(birdPositionMovedBy); } } \ No newline at end of file