-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStartScreen.pde
More file actions
executable file
·209 lines (183 loc) · 5.69 KB
/
StartScreen.pde
File metadata and controls
executable file
·209 lines (183 loc) · 5.69 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/*
スタート画面
*/
class StartScreen{
Play play; // ブロック崩し本体
Map map;
PImage start;
PImage cursor1;
PImage titleBar1;
PImage titleBar1on;
PImage titleBar2;
PImage titleBar2on;
PImage titleBar3;
PImage titleBar3on;
PImage howToPlay;
PImage congrats;
int state;
int stage;
int mouseBallMax[];
int squareMaps[][][];
int circleMaps[][][];
int ballMaps[][][];
int boxMaps[][][];
int playCount;
StartScreen(){
map = new Map();
mouseBallMax = map.getMouseBallMax();
squareMaps = map.getSquareMaps();
circleMaps = map.getCircleMaps();
ballMaps = map.getBallMaps();
boxMaps = map.getBoxMaps();
start = loadImage("start.png");
cursor1 = loadImage("cursor_1.png");
titleBar1 = loadImage("title_bar_1.png");
titleBar1on = loadImage("title_bar_1_on.png");
titleBar2 = loadImage("title_bar_2.png");
titleBar2on = loadImage("title_bar_2_on.png");
titleBar3 = loadImage("title_bar_3.png");
titleBar3on = loadImage("title_bar_3_on.png");
howToPlay = loadImage("how_to_play.png");
congrats = loadImage("congrats.png");
state = 1;
playCount = 0;
}
void show(){
if(state == 1){
image(start, 0,0);
if(mouseX >= 220 && mouseX <= 580 && mouseY >= 400 && mouseY <= 460)
image(titleBar1on, 220, 400, 360,60);
else
image(titleBar1, 220, 400, 360,60);
if(mouseX >= 220 && mouseX <= 580 && mouseY >= 470 && mouseY <= 530)
image(titleBar2on, 220, 470, 360,60);
else
image(titleBar2, 220, 470, 360,60);
}
if(state == 2){
for(int j=0; j<2 ; j++){
for(int i=0; i<3; i++){
fill(255,255,255);
rect(i*210 + 100, j*210 + 100,180,180);
fill(0,0,0);
textSize(50);
textAlign(LEFT);
text("stage"+ (i+1+j*3) , i*210 + 100+10, j*210 + 200);
}
}
if(mouseX >= 20 && mouseX <= 320 && mouseY >= 530 && mouseY <= 580)
image(titleBar3on, 20, 530, 300,50);
else
image(titleBar3, 20, 530, 300,50);
}
if(state == 3){
image(howToPlay,0,0);
if(mouseX >= 20 && mouseX <= 320 && mouseY >= 530 && mouseY <= 580)
image(titleBar3on, 20, 530, 300,50);
else
image(titleBar3, 20, 530, 300,50);
}
if(state == 0){
this.play();
}
if(state == 4){
image(congrats, 0, 0);
if(mouseX >= 20 && mouseX <= 220 && mouseY >= 540 && mouseY <= 580)
image(titleBar3on, 20, 540);
else
image(titleBar3, 20, 540);
}
if(state != 0)
image(cursor1, mouseX + random(-3,3) -15, mouseY + random(-3,3) -15, 30,30);
}
void play(){
play.draw();
if( play.getBackFlag() ){
playCount = 0;
state = 2;
}
if( play.getNextFlag() ){
playCount = 0;
stage ++;
play = new Play(stage, squareMaps[stage-1], circleMaps[stage-1],
ballMaps[stage-1], boxMaps[stage-1], mouseBallMax[stage-1] );
}
if( play.getRetryFlag() ){
playCount = 0;
play = new Play(stage, squareMaps[stage-1], circleMaps[stage-1],
ballMaps[stage-1], boxMaps[stage-1], mouseBallMax[stage-1] );
}
if( play.getCongratsFlag() ){
playCount = 0;
state = 4;
}
}
void mousePressed(){
if(state == 1){
if(mouseX >= 220 && mouseX <= 580 && mouseY >= 400 && mouseY <= 460)
state = 2;
if(mouseX >= 220 && mouseX <= 580 && mouseY >= 470 && mouseY <= 530)
state = 3;
}
else if(state == 2){
if(mouseX >= 20 && mouseX <= 320 && mouseY >= 530 && mouseY <= 580)
state = 1;
if(mouseX >= 100 && mouseX <= 280 && mouseY >= 100 && mouseY <= 280){
state = 0;
stage = 1;
play = new Play(stage, squareMaps[0], circleMaps[0], ballMaps[0], boxMaps[0], mouseBallMax[0]);
}
if(mouseX >= 310 && mouseX <= 490 && mouseY >= 100 && mouseY <= 280){
state = 0;
stage = 2;
play = new Play(stage, squareMaps[1], circleMaps[1], ballMaps[1], boxMaps[1], mouseBallMax[1]);
}
if(mouseX >= 520 && mouseX <= 700 && mouseY >= 100 && mouseY <= 280){
state = 0;
stage = 3;
play = new Play(stage, squareMaps[2], circleMaps[2], ballMaps[2], boxMaps[2], mouseBallMax[2]);
}
if(mouseX >= 100 && mouseX <= 280 && mouseY >= 310 && mouseY <= 490){
state = 0;
stage = 4;
play = new Play(stage, squareMaps[3], circleMaps[3], ballMaps[3], boxMaps[3], mouseBallMax[3]);
}
if(mouseX >= 310 && mouseX <= 490 && mouseY >= 310 && mouseY <= 490){
state = 0;
stage = 5;
play = new Play(stage, squareMaps[4], circleMaps[4], ballMaps[4], boxMaps[4], mouseBallMax[4]);
}
if(mouseX >= 520 && mouseX <= 700 && mouseY >= 310 && mouseY <= 490){
state = 0;
stage = 6;
play = new Play(stage, squareMaps[5], circleMaps[5], ballMaps[5], boxMaps[5], mouseBallMax[5]);
}
}
else if(state == 3){
if(mouseX >= 20 && mouseX <= 320 && mouseY >= 530 && mouseY <= 580)
state = 1;
}
else if(state == 4){
if(mouseX >= 20 && mouseX <= 220 && mouseY >= 540 && mouseY <= 580)
state = 1;
}
else if(state == 0){
play.mousePressed();
}
}
void mouseReleased(){
if(state == 0){
if(playCount > 0)
play.mouseReleased();
playCount ++;
}
}
void keyPressed(char key, int keyCode){
if(state == 0)
play.keyPressed(key, keyCode);
}
void keyReleased(char key, int keyCode){
if(state == 0)
play.keyReleased(key, keyCode);
}
}