-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathScreens.pde
583 lines (533 loc) · 16.2 KB
/
Screens.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
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
void menuScreen() { //The screen for the main menu, this is where the game starts up, and the player chooses where to go from here.
background(255);
//Setting Up the Title
fill(255, 0, 0); //Makes the title box red
rect(width/2, 65, width, 100); //Makes the title box
textSize(100); //Making the title big
fill(0); //Making the text black
text("Inner Demons", 150, 100); //Making the text appear
//Making Buttons
rectMode(CENTER);
stroke(0); //Setting the border of the button
fill(255); //Making the button look white
rect(width/2, 200, 300, 100); //Top Button - Play
rect(width/2, 400, 300, 100); //Mid Button - Options
rect(width/2, 600, 300, 100); //Low Button - Quit
//Adding Text to buttons
textSize(75);
fill(0); //Making the text black
text("Play", (width/2)-70, 200+25); //Top Button - Text(Play)
text("Options", (width/2)-140, 400+25); //Mid Button - Text(Options)
text("Quit", (width/2)-85, 600+25); //Low Button - Text(Quit)
if (mousePressed) {
if (mouseX >= (width/2)-150 && mouseX<=(width/2)+150) { //Goes to character selection screen
if (mouseY>= 200-50 && mouseY<= 200+50) {
characterScreen = true;
menuScreen = false;
}
}
if (mouseX >= (width/2)-150 && mouseX<=(width/2)+150) { //Goes to settings screen
if (mouseY>=400-50 && mouseY<=400+50) {
optionsScreen = true;
menuScreen = false;
}
}
if (mouseX >= (width/2)-150 && mouseX<=(width/2)+150) { //Goes to quit confirmation screen
if (mouseY >= 600-50 && mouseY<=600+50) {
quitScreen = true;
menuScreen = false;
}
}
}
}
void characterScreen() { //The character selection screen, this is where the player will choose what their character looks like.
background(0);
//Title
fill(255); //Makes the text white
textSize(80); //Makes the text size 80
text("Character Selection", 100, 80); //Makes the text
//Character Settings
fill(255);
textSize(50);
text("Gender", 690, 160);
text("Preset", 700, 340);
//Setting Buttons
rectMode(LEFT); //Changes how the rect is displayed
rectMode(0);
fill(0);
stroke(255);
rect(640, 180, 270, 100); //Gender Box
rect(640, 360, 270, 240); //Preset Box
//Inner Gender Buttons
rect(660, 200, 100, 60); //Male Button
rect(790, 200, 100, 60); //Female Button
//Inner Preset Buttons
rect(680, 375, 75, 50); //Preset 1
rect(800, 375, 75, 50); //Preset 2
rect(680, 455, 75, 50); //Preset 3
rect(800, 455, 75, 50); //Preset 4
rect(680, 535, 75, 50); //Preset 5
rect(800, 535, 75, 50); //Preset 6
//Continue Button
rect(690, 615, 270, 75);
//Back Button
rect(40, 615, 200, 75);
//Gender Button Text
fill(255);
textSize(30);
text("BOY", 680, 240);
text("GIRL", 805, 240);
//Preset Button Text
text("1", 710, 410); //Preset 1
text("2", 830, 410); //Preset 2
text("3", 710, 490); //Preset 3
text("4", 830, 490); //Preset 4
text("5", 710, 570); //Preset 5
text("6", 830, 570); //Preset 6
//Continue Button Text
textSize(50);
text("Continue", 710, 670);
//Back Button Text
textSize(50);
text("Back", 80, 670);
if (mousePressed) {
if (mouseX >=660 && mouseX<= 760) { //Selecting BOY
if (mouseY >= 200 && mouseY<= 260) {
gender = "Male";
}
}
if (mouseX>=790 && mouseX<=890) { //Selecting GIRL
if (mouseY >= 200 && mouseY<= 260) {
gender = "Female";
}
}
if (mouseX>=680 && mouseX<=755) { //Selecting Preset 1
if (mouseY>=375 && mouseY<=425) {
preset = 1;
}
}
if (mouseX>=800 && mouseX<=875) { //Selecting Preset 2
if (mouseY>=375 && mouseY<=425) {
preset = 2;
}
}
if (mouseX>=680 && mouseX<=755) { //Selecting Preset 3
if (mouseY>=455 && mouseY<=505) {
preset = 3;
}
}
if (mouseX>=800 && mouseX<=875) { //Selecting Preset 4
if (mouseY>=455 && mouseY<=505) {
preset = 4;
}
}
if (mouseX>=680 && mouseX<=755) { //Selecting Preset 5
if (mouseY>=535 && mouseY<=585) {
preset = 5;
}
}
if (mouseX>=800 && mouseX<=875) { //Selecting Preset 6
if (mouseY>=535 && mouseY<=585) {
preset = 6;
}
}
if (mouseX>=40 && mouseX<=240) { //Back Button
if (mouseY>=615 && mouseY<=690) {
menuScreen = true;
characterScreen = false;
}
}
if (mouseX>=690 && mouseX<=690+270) { //Continue Button
if (mouseY>=615 && mouseY<=690) {
difficultyScreen = true;
characterScreen = false;
}
}
}
String name = "";
if (preset == 1) {
name = "Freddie";
}
if (preset == 2) {
name = "Michael";
}
if (preset == 3) {
name = "Eric";
}
if (preset == 4) {
name = "Ben";
}
if (preset == 5) {
name = "Shayne";
}
if (preset == 6) {
name = "The nameless one";
}
if (gender == "Female") {
name = name+"a";
}
//Preview Screen
rectMode(LEFT); //Changes how the rect is displayed
fill(0); //Makes the box look transparent
stroke(255); //Makes the border look white
rect(20, 100, 600, 600);
fill(255);
textSize(30);
spriteSheet = loadImage(presetVar);
PImage display =spriteSheet.get(10 + 0, 706, 40, 65);
display.resize(200, 400);
text("Preview", 270, 130);
text("Character: " +name, 25, 590);
image(display, 230, 100);
PImage displayWeapon = weaponImage[8];
displayWeapon.resize(200, 75);
image(displayWeapon, 280, 345);
}
void quitScreen() { //This is the quit confirmation screen, it basically just asks if the player really wants to switch screens.
background(0);
//Setting the title
textSize(100);
fill(255);
text("Are you sure?", 150, 100);
//Setting the buttons
rectMode(0);
fill(0);
stroke(255);
rect(100, 550, 200, 100); //Setting YES button
rect(700, 550, 200, 100); //Setting NO button
//Button Text
fill(255);
textSize(50);
text("Yes", 150, 620); //Setting YES button text
text("No", 760, 620); //Setting NO button text
if (mousePressed) {
if (mouseX>=100 && mouseX<=300) {
if (mouseY>=550 && mouseY<=650) { //Selects YES
exit();
}
}
if (mouseX>=700 && mouseX<=900) {
if (mouseY>= 550 && mouseY<=650) { //Selects NO
menuScreen = true;
quitScreen = false;
}
}
}
}
void difficultyScreen() { //Difficulty selection screen, player chooses how hard they want the game to be.
background(0);
//Setting up title
fill(255);
textSize(100);
text("Select Difficulty", 100, 100);
//Creating buttons
fill(0);
stroke(255);
rectMode(0);
rect(50, 350, 200, 100); //Setting EASY button
rect(400, 350, 200, 100); //Setting NORMAL button
rect(750, 350, 200, 100); //Setting HARD button
rect(width/2+10, 500, 200, 100); //Setting START button
rect((width/2)-210, 500, 200, 100); //Setting BACK button
//Setting button text
fill(255);
textSize(50);
text("Easy", 95, 420); //Setting EASY button text
text("Normal", 410, 420); //Setting NORMAL button text
text("Hard", 795, 420); //Setting HARD button text
text("Back", 340, 570); //Setting BACK button text
text("Start", 550, 570); //Setting START button text
//Setting Button Display Circle
fill(0);
stroke(255);
ellipse(250, 350, 25, 25); //Display Circle for EASY
ellipse(600, 350, 25, 25); //Display Circle for NORMAL
ellipse(950, 350, 25, 25); //Display Circle for HARD
if (difficulty == 1) { //Visual Display for EASY mode
fill(0, 255, 0);
stroke(255);
ellipse(250, 350, 25, 25);
}
if (difficulty == 2) { //Visual Display for NORMAL mode
fill(0, 255, 0);
stroke(255);
ellipse(600, 350, 25, 25);
}
if (difficulty == 3) { //Visual Display for HARD mode
fill(0, 255, 0);
stroke(255);
ellipse(950, 350, 25, 25);
}
if (mousePressed) {
if (mouseX>=50 && mouseX<=250) {
if (mouseY>=350 && mouseY<=450) { //Sets the difficulty to 1 (EASY)
difficulty = 1;
}
}
if (mouseX>=400 && mouseX<=600) {
if (mouseY>=350 && mouseY<=450) { //Sets the difficulty to 2 (NORMAL)
difficulty = 2;
}
}
if (mouseX>=750 && mouseX<=950) {
if (mouseY>=350 && mouseY<= 450) { //Sets the difficulty to 3 (HARD)
difficulty = 3;
}
}
if (mouseX>=width/2-210 && mouseX<=width/2-10) {
if (mouseY>=500 && mouseY<= 600) { //Goes back to character selection screen
characterScreen = true;
difficultyScreen = false;
}
}
if (mouseX>=width/2+10 && mouseX<=width/2+210) {
if (mouseY>=500 && mouseY<= 600) { //Goes to the game screen
gameScreen = true;
difficultyScreen = false;
}
}
}
}
void gameScreen() { //The start of the game screen - This is where all the action will take place.
if (level >= 0 && level < 5) {
startBackground.resize(width, height);
background(startBackground); //This will be replaced with dialouge, but for now it's just this
monsterCall();
}
if (level >= 5 && level<10) {
background2.resize(width, height);
background(background2);
}
if (level >=10 && level < 15) {
background3.resize(width, height);
background(background3);
}
if (level >=15 && level < 20) {
background4.resize(width, height);
background(background4);
}
if (level==20) {
bossBackground.resize(width, height);
background(bossBackground);
}
if (level >= 21) {
winScreen = true;
gameScreen = false;
}
if (chestAppearLuck == 2) {
randomChest.chestDisplay();
}
Bob.setupSprites();
Bob.drawPlayer();
screenDisplay();
}
void optionsScreen() { //This is where the player can choose between: Settings - Help - Credits
background(255);
//Setting up title
fill(0);
textSize(100);
text("Options", 300, 100);
//Setting up buttons
fill(255);
strokeWeight(1);
rectMode(0);
stroke(0);
rect(750, 200, 200, 100); //Creating HELP button
rect(750, 350, 200, 100); //Creating SETTINGS Button
rect(750, 500, 200, 100); //Creating CREDITS Button
rect(20, 550, 200, 100); //Creating BACK Button
//Setting up button text
fill(0);
textSize(50);
text("Help", 790, 265); //Creating HELP button text
text("Settings", 755, 415); //Creating SETTINGS button text
text("Credits", 770, 565); //Creating CREDITS button text
text("Back", 60, 615); //Creating BACK button text
if (mousePressed) {
if (mouseX>=750 && mouseX<=950) { //Selects HELP button
if (mouseY>=200 && mouseY<=300) {
helpScreen = true;
optionsScreen = false;
}
}
if (mouseX>=750 && mouseX<=950) { //Selects SETTINGS button
if (mouseY>=350 && mouseY<=450) {
}
}
if (mouseX>=750 && mouseX<=950) { //Selects CREDITS button
if (mouseY>=500 && mouseY<=700) {
creditsScreen = true;
y = 700;
optionsScreen = false;
}
}
if (mouseX>=20 && mouseX<=220) { //Selects BACK button
if (mouseY>=550 && mouseY<=650) {
menuScreen = true;
optionsScreen = false;
}
}
}
}
void creditsScreen() { //Credits screen
/*
The best way to describe this screen:
This text is all attatched to the y variable, which is constantly moving upwards.
This makes all the text scroll upwards like normal credits you'd see in a movie.
*/
int x = width/2-200;
y--;
if (y<= -1000) {
optionsScreen = true;
creditsScreen = false;
}
background(0);
//Setting Title
textSize(100);
fill(255);
text("Credits", x, y);
text("Developers", x-100, y+100);
textSize(50);
text("Ben Kennard", x, y+200);
text("Eric Mazza", x, y+300);
text("Shayne Lisk", x, y+400);
textSize(100);
text("Special Thanks", x-200, y+500);
textSize(50);
text("PiskelApp - Used for weapons", x-200, y+600); //Where we made the weapons and chest and background animations
text("Github - Collaboration", x-200, y+700); //Where we share all our code
text("Gaurav Munjal - SpriteSheets", x-200, y+800); //Universal Sprite Sheet Maker (This is the creator of the site we used for character sprites)
text("Project Crystal - Site Hosting", x-200, y+900); //Website hosting
textSize(75);
text("Thanks for playing!", x-200, y+1000);
}
void pauseScreen() { //Pause screen- this is where the player will be able to adjust the items in their inventory
fill(255, 80);
stroke(0);
rectMode(CENTER);
rect(width/2, height/2, 500, 500);
fill(0);
textSize(40);
text("Inventory", 400, 150);
rectMode(0);
fill(255, 80);
stroke(0);
//Row 1
rect(280, 250, 100, 100);
rect(395, 250, 100, 100);
rect(510, 250, 100, 100);
rect(625, 250, 100, 100);
//Row 2
rect(280, 400, 100, 100);
rect(395, 400, 100, 100);
rect(510, 400, 100, 100);
rect(625, 400, 100, 100);
if (mousePressed) {
if (mouseX>=280 && mouseX<= 380) {
if (mouseY>=250 && mouseY<=350) {
currentWeapon = inventoryTrack[1];
}
}
if (mouseX>=395 && mouseX<= 495) {
if (mouseY>=250 && mouseY<=350) {
if (inventory[2] == null) return;
currentWeapon = inventoryTrack[2];
}
}
if (mouseX>=510 && mouseX<= 610) {
if (mouseY>=250 && mouseY<=350) {
if (inventory[3] == null) return;
currentWeapon = inventoryTrack[3];
}
}
if (mouseX>=625 && mouseX<= 725) {
if (mouseY>=250 && mouseY<=350) {
if (inventory[4] == null) return;
currentWeapon = inventoryTrack[4];
}
}
if (mouseX>=280 && mouseX<= 380) {
if (mouseY>=400 && mouseY<=500) {
if (inventory[5] == null) return;
currentWeapon = inventoryTrack[5];
}
}
if (mouseX>=395 && mouseX<= 495) {
if (mouseY>=400 && mouseY<=500) {
if (inventory[6] == null) return;
currentWeapon = inventoryTrack[6];
}
}
if (mouseX>=510 && mouseX<= 610) {
if (mouseY>=400 && mouseY<=500) {
if (inventory[7] == null) return;
currentWeapon = inventoryTrack[7];
}
}
if (mouseX>=625 && mouseX<= 725) {
if (mouseY>=400 && mouseY<=500) {
if (inventory[8] == null) return;
currentWeapon = inventoryTrack[8];
}
}
}
image(inventory[1], 300, 265);
if (inventory[2] == null) return;
image(inventory[2], 400, 265);
if (inventory[3] == null) return;
image(inventory[3], 530, 265);
if (inventory[4] == null) return;
image(inventory[4], 650, 265);
if (inventory[5] == null) return;
image(inventory[5], 300, 415);
if (inventory[6] == null) return;
image(inventory[6], 400, 415);
if (inventory[7] == null) return;
image(inventory[7], 530, 415);
if (inventory[8] == null) return;
image(inventory[8], 650, 415);
}
void deathScreen() { //Death screen, this shows when the player has reached 0% health
background(0);
fill(255);
textSize(200);
text("YOU DIED", 30, 300);
}
void winScreen() { //Win screen, this shows when the player has beat the boss level(Level 20) in the gameScreen.
background(0);
fill(255);
textSize(200);
text("YOU WIN", 60, 300);
}
void helpScreen() {
background(255);
fill(0);
textSize(100);
text("Help", 400, 100);
textSize(30);
text("If you need help, please refer to the game website.", 10, 160);
text("It lists any and all information that you might need to know about", 10, 200);
text("this game, and how to play it. Have fun!", 10, 240);
fill(255);
rect(90, 370, 700, 40); //Link box
rect(20, 450, 200, 100); //Back box
fill(0);
textSize(80);
text("Back", 30, 530);
fill(0, 0, 255);
textSize(30);
text("http://projectcrystal.ddns.net/Inner-Demons/", 100, 400);
if (mousePressed) {
if (mouseX>=90 && mouseX<=790) {
if (mouseY>=370 && mouseY<=410) {
link("http://projectcrystal.ddns.net/Inner-Demons/");
}
}
if (mouseX>=20 && mouseX<=220) {
if (mouseY>=450 && mouseY<= 550) {
optionsScreen = true;
helpScreen = false;
}
}
}
}