blob: 52907ad16c1fd0b9a189170b12feaa3d284a1001 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
package main;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
public class ScoreController{
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()
{
return score;
}
/**
* @return current combo
*/
public int getCombo()
{
return combo;
}
/**
* @param newScore: the score to be set, only used in debug
*/
public void setScore(int newScore)
{
score = newScore;
scoreProperty.setValue(newScore+"");
}
/**
* @param newCombo: the combo to be set, only used in debug
*/
public void setCombo(int newCombo)
{
combo = newCombo;
comboProperty.setValue(newCombo+"");
}
/**
* prints values into console
*/
public void print()
{
System.out.println("--");
System.out.println(combo);
System.out.println(score);
System.out.println("");
System.out.println(scoreProperty);
System.out.println(comboProperty);
}
}
|