-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOther_States.pde
68 lines (57 loc) · 1.29 KB
/
Other_States.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
63
64
65
66
67
68
void gameOverState() {
textAlign(CENTER, CENTER);
textSize(30);
fill(255,0,0);
text("You Fucking Looser.", width/2, height/3);
rectMode(CENTER);
if (isHoverOnPlay)
fill(134, 134, 134);
else
fill(255);
noStroke();
rect(width/2, height/2+5, 200, 50);
fill(0);
text("Play Again?", width/2, height/2);
}
void gamePauseState() {
fill(255);
noStroke();
textAlign(CENTER, CENTER);
textSize(25);
text("Press P to continue", width/2, height/2);
}
boolean isHoverOnPlay = false;
void introState() {
clear();
textAlign(CENTER, CENTER);
textSize(30);
fill(255);
text("Snake", width/2, height/3);
rectMode(CENTER);
if (isHoverOnPlay)
fill(134, 134, 134);
else
fill(255);
rect(width/2, height/2+5, 100, 50);
fill(0);
text("Play", width/2, height/2);
}
void touchStarted(){mouseMoved();}
void mouseMoved() {
if (STATE == 1)
isHoverOnPlay =
mouseX >= width/2 - 50 && mouseX <= width/2+50 &&
mouseY >= height/2-25 && mouseY <= height/2+30;
else if (STATE == 4)
isHoverOnPlay =
mouseX >= width/2 - 100 && mouseX <= width/2+100 &&
mouseY >= height/2-25 && mouseY <= height/2+30;
else
isHoverOnPlay = false;
}
void mouseClicked() {
if (STATE == 1 || STATE == 4)
if (isHoverOnPlay) {
STATE = 0;
}
}