-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayer.pde
More file actions
38 lines (35 loc) · 732 Bytes
/
player.pde
File metadata and controls
38 lines (35 loc) · 732 Bytes
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
class Player {
int number, score;
color c;
Paddle paddle; //each player has a paddle
Player(int number_, color c_) {
c = c_;
number = number_;
paddle = new Paddle(number, c);
score = 0;
}
void display() {
//displays the score for each player in their corresponding color
textSize(15);
textAlign(CENTER);
fill(c);
switch(number) {
case 1:
// left edge
text(str(score), 20, 20);
break;
case 2:
// top edge
text(str(score), width - 20, 20);
break;
case 3:
// right edge
text(str(score), width - 20, height - 20);
break;
case 4:
// bottom edge
text(str(score), 20, height - 20);
break;
}
}
}