-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScore.pde
62 lines (56 loc) · 1.08 KB
/
Score.pde
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
class Score{
boolean[] birdsTouched = new boolean[10];
PVector scoreBoardLocation = new PVector(300,500);
int scoreBoardSize = 10;
Score(){
for(int i = 0; i < birdsTouched.length; i++){
birdsTouched[i] = false;
}
}
void update(){
noStroke();
checkWin();
for(int i = 0; i<birdsTouched.length; i++){
if(birdsTouched[i]){
fill(255);
}
else{
fill(100);
}
if(!gameWon){
rect(scoreBoardLocation.x+(i*scoreBoardSize*2), scoreBoardLocation.y, scoreBoardSize, scoreBoardSize);
}
}
}
void touchBird(){
for(i = 0; i<birdsTouched.length; i++){
if(!birdsTouched[i]){
birdsTouched[i] = true;
return;
}
}
for(i = 0; i<birdsTouched.length; i++){
birdsTouched[i] = false;
}
dancer[0].startDancer();
}
void birdEscaped(){
for(i = birdsTouched.length - 1; i>=0; i--){
if(birdsTouched[i]){
birdsTouched[i] = false;
return;
}
}
if(!gameWon){
dancer[0].stopDancer();
}
}
void checkWin(){
if(dancer[(dancer.length-1)].isDancing){
if(!gameWon){
gameWon = true;
//println("You win!");
}
}
}
}