From 92f0e69cc938a058805e41780cb8a1bc7e6abda1 Mon Sep 17 00:00:00 2001 From: Aidan Ross Date: Sun, 28 May 2023 21:05:30 -0400 Subject: 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 --- src/main/ScoreController.java | 61 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 4 deletions(-) (limited to 'src/main') 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,11 +5,64 @@ 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 */ @@ -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) { -- cgit v1.2.3