-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScore.pde
More file actions
64 lines (53 loc) · 1.21 KB
/
Score.pde
File metadata and controls
64 lines (53 loc) · 1.21 KB
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
class Score {
private int score;
private int score2;
// Initializes scores to 0
Score() {
score = 0;
score2 = 0;
}
// Returns the score
int getScore() {
return score;
}
// Increments player 1's score
void increase() {
score += 1;
}
// Increments player 2's score
void increaseScore2() {
score2 += 1;
}
// Resets both scores to 0
void reset() {
score = 0;
score2 = 0;
}
// Displays the score(s) based on whether the mode is 1P/2P
void display(float x, float y) {
if (gc.is2P) {
fill(100);
rectMode(CENTER);
rect(x, y-18, 136, 100);
fill(255);
textFont(arial);
textAlign(CENTER, CENTER);
textSize(18);
text("Score", x, y-50);
textSize(32);
text("P1: " + str(this.score), x, y-25);
text("P2: " + str(this.score2), x, y + 8);
} else {
fill(100);
rectMode(CENTER);
rect(x, y-11, 136, 80);
fill(255);
textFont(arial);
textAlign(CENTER, CENTER);
textSize(18);
text("Score", x, y-30);
textSize(48);
text(str(this.score), x,y);
}
}
}