diff options
author | Aidan Ross <aross02@fairport.org> | 2023-05-28 21:05:30 -0400 |
---|---|---|
committer | Aidan Ross <aross02@fairport.org> | 2023-05-28 21:05:30 -0400 |
commit | 92f0e69cc938a058805e41780cb8a1bc7e6abda1 (patch) | |
tree | 1efe8b46e4db7d4bc9a4d112f310ffe3f0d79768 /src/main | |
parent | 9d07f0eb68e7779e8868b18a51bee5f8eb23b31e (diff) | |
download | NPEhero-92f0e69cc938a058805e41780cb8a1bc7e6abda1.tar.gz NPEhero-92f0e69cc938a058805e41780cb8a1bc7e6abda1.tar.bz2 NPEhero-92f0e69cc938a058805e41780cb8a1bc7e6abda1.zip |
Removed unnecesary files in the gameplay class, as well as merged gameplay.score with main.scoreController such that score and combo are now displayed properly on the screen
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/ScoreController.java | 61 |
1 files changed, 57 insertions, 4 deletions
diff --git a/src/main/ScoreController.java b/src/main/ScoreController.java index a33c873..52907ad 100644 --- a/src/main/ScoreController.java +++ b/src/main/ScoreController.java @@ -5,12 +5,65 @@ import javafx.beans.property.StringProperty; public class ScoreController{ - int score = 0; - int combo = 0; + private int score = 0; + private int combo = 0; + private int comboMultiplier=1; public StringProperty scoreProperty = new SimpleStringProperty("0"); public StringProperty comboProperty = new SimpleStringProperty("0"); /** + * Called when the user performs a perfect hit + */ + public void perfect() { + combo(); + score += 300*comboMultiplier; + scoreProperty.setValue(score+""); + comboProperty.setValue(combo +""); + System.out.println("Perfect!"); + } + + /** + * called when the user performs an okay hit + */ + public void good() { + combo(); + score += 100*comboMultiplier; + scoreProperty.setValue(score+""); + comboProperty.setValue(combo+""); + System.out.println("Good"); + } + + /** + * Called when the user misses a note + */ + public void miss() { + combo = 0; + comboMultiplier = 1; + scoreProperty.setValue(score+""); + comboProperty.setValue(combo+""); + System.out.println("Miss"); + } + + /* + * Increments the combo by one + */ + private void combo() { + combo++; + + if (combo == 2) { + comboMultiplier = 2; + } + + if (combo == 4) { + comboMultiplier = 4; + } + + if (combo == 8) { + comboMultiplier = 8; + } + } + + /** * @return current score */ public int getScore() @@ -27,7 +80,7 @@ public class ScoreController{ } /** - * @param newScore: the score to be set + * @param newScore: the score to be set, only used in debug */ public void setScore(int newScore) { @@ -36,7 +89,7 @@ public class ScoreController{ } /** - * @param newCombo: the combo to be set + * @param newCombo: the combo to be set, only used in debug */ public void setCombo(int newCombo) { |