-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGameMenu.pde
77 lines (67 loc) · 2.5 KB
/
GameMenu.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
69
70
71
72
73
74
75
76
77
class GameMenu {
Level_2 level_2=new Level_2();
level1 Level1=new level1();
boolean Menu = true, Play;
float Button1 = 50, Button2 = 50, Button3 = 50 ,Button4=100 ; //opacity
void startMenu() {
//Button 1:
fill(210, 44, 44,Button1+150); //Button margin colour
rect(500, 500, 150, 50, 20); //Drawing the button
fill(255); //Font colour for inside of the button
//Button text
textSize(40);
text("Play", 500 + (textWidth("Play") / 2),525 + ((textAscent() - textDescent()) / 2));
//Button 2:
fill(210, 44, 44,Button2+150); //Button margin colour
rect(500,560, 150, 50, 20); //Drawing the button
fill(255); //Font colour for inside of the button
//Button text
text("Guide", 500 + (textWidth("Guide") / 2)-30, 585 + ((textAscent() - textDescent()) / 2));
//Button 3:
fill(210, 44, 44,Button3+150); //Button margin colour
rect(500, 620, 150, 50, 20); //Drawing the button
fill(255); //Font colour for inside of the button
//Button text
text("Quit", 500 + (textWidth("Quit") / 2), 645 + ((textAscent() - textDescent()) / 2) );
if (Menu) {
if (mouseX > 500 && mouseX < 500 + 100
&& mouseY > 500 && mouseY < 500 + 50 ) { //pointer collision with Button1
if (mousePressed) {
file.play();
file.loop();
gameScreen=1;
resetGame();
}
if (Button1 < 150) { //Highlighting effect by darkening the colour for button 1
Button1 += 200;
}
}
else if (Button1 > 100) { //out back to first color
Button1 -= 100;
}
if (mouseX > 500 && mouseX < 500 + 100
&& mouseY > 560 && mouseY < 560 + 50) { //pointer collision with Button2
if (mousePressed) {
//Call guide window over here
thirdScreen();
}
if (Button2 < 150) { //Highlighting effect by darkening the colour for button 2
Button2 += 200;
}
} else if (Button2 > 100) {
Button2 -= 100;
}
if (mouseX > 500 && mouseX < 500 + 100
&& mouseY > 620 && mouseY < 620+50) { //pointer collision with Button3
if (mousePressed) {
exit(); //Quits the window
}
if (Button3 < 150) { //Highlighting effect by darkening the colour for button 3
Button3 += 200;
}
} else if (Button3 > 100) {
Button3 -= 100;
}
}
}
}