aboutsummaryrefslogtreecommitdiff
path: root/src/main/ScoreController.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/ScoreController.java')
-rw-r--r--src/main/ScoreController.java61
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)
{