-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
1028 lines (901 loc) · 35.2 KB
/
main.py
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
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import pygame
import os
import random
screen_length = 465
screen_height = 350
dim_field = (screen_length, screen_height)
screen = pygame.display.set_mode(dim_field)
num_points = 0
num_lives = 3
quote = "Move into mentors or professors."
#Make sound affect for Jonny - duh duh duh duh duh duh duh duh
quote_list = [
"My favorite mode of transportation is the 'chicken bus' - Curt",
"join the crochet cult >:) we have alliterations - Hannah", "What does the sloth say? - Jonny",
"Science compels us to explode the sun! - Josh",
"Do or do not. There is no try. – Michael",
"I'm gonna spill some hot tea!!! - Gary", "Your mom. - Diego",
"You miss 100% of the naps you don't take. - Akshat",
"I want to thank the students for starting a cult in my name - Niema",
"Does Geisel have a lot of books? - Younus",
"Start Early, Start Often. - Elisa", "Word - Henry L",
"Not all who wonder are lost. - Henry X", "Sus it out - Jenelle",
"Be the best version of yourself - Lindsey",
"Shoot for the moon. If you miss you'll land on a star. - Tristin",
"When life gives you lemons make lemonade - Prothit", ":P - Nikki",
"SHEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEESH - Yukati",
"Live, laugh, Love - John"]
#Draw all the players out here in future
player_x = 218
player_y = 40
player_width = 23
player_height = 23
player_rect = pygame.Rect(player_x, player_y, player_width, player_height)
player = pygame.image.load(os.path.join("curt", "camel.png")).convert()
player.set_colorkey((0, 0, 0))
player = pygame.transform.scale(player, (player_width, player_height))
#Hannah
hannah_x = 385
hannah_y = 250
hannah_rect = pygame.Rect(hannah_x, hannah_y, 23, 23)
hannah = pygame.image.load(os.path.join("curt", "hannah.png")).convert()
hannah.set_colorkey((255, 0, 0))
hannah = pygame.transform.scale(hannah, (23, 23))
#Jonny
jonny_x = 150
jonny_y = 145
jonny_rect = pygame.Rect(jonny_x, jonny_y, 23, 23)
jonny = pygame.image.load(os.path.join("curt", "jonny.png")).convert()
jonny.set_colorkey((0, 255, 0))
jonny = pygame.transform.scale(jonny, (25, 25))
#Josh
josh_x = 45
josh_y = 200
josh_rect = pygame.Rect(josh_x, josh_y, 23, 23)
josh = pygame.image.load(os.path.join("curt", "josh.png")).convert_alpha()
josh.set_colorkey((255, 255, 255))
josh = pygame.transform.scale(josh, (23, 23))
#Michael
michael_x = 285
michael_y = 200
michael_rect = pygame.Rect(michael_x, michael_y, 23, 23)
michael = pygame.image.load(os.path.join("curt", "michael.png")).convert()
michael.set_colorkey((0, 0, 0))
michael = pygame.transform.scale(michael, (23, 23))
#Gary player
gplayer_x = 15
gplayer_y = 40
gplayer_rect = pygame.Rect(gplayer_x, gplayer_y, 23, 23)
gplayer = pygame.image.load(os.path.join("gary", "gary.png")).convert()
gplayer.set_colorkey((0, 255, 0))
gplayer = pygame.transform.scale(gplayer, (23, 23))
#Diego
diego_x = 15
diego_y = 305
diego_rect = pygame.Rect(diego_x, diego_y, 23, 23)
diego = pygame.image.load(os.path.join("gary", "diego.png")).convert()
diego.set_colorkey((255, 255, 255))
diego = pygame.transform.scale(diego, (23, 23))
#Alarm clock
aclock_x = 425
aclock_y = 40
aclock_rect = pygame.Rect(aclock_x, aclock_y, 23, 23)
aclock = pygame.image.load(os.path.join("gary", "alarm_clock.png")).convert()
aclock.set_colorkey((0, 0, 0))
aclock = pygame.transform.scale(aclock, (23, 23))
#Akshat
akshat_x = 425
akshat_y = 305
akshat_rect = pygame.Rect(akshat_x, akshat_y, 23, 23)
akshat = pygame.image.load(os.path.join("gary", "akshat.png")).convert()
akshat.set_colorkey((0, 0, 0))
akshat = pygame.transform.scale(akshat, (23, 23))
#Niema
nplayer_x = 215
nplayer_y = 210
nplayer_rect = pygame.Rect(nplayer_x, nplayer_y, 20, 15)
nplayer = pygame.image.load(os.path.join("niema", "honda.png")).convert()
nplayer.set_colorkey((0, 0, 0))
nplayer = pygame.transform.scale(nplayer, (35, 25))
#Younus
younus_x = 70
younus_y = 200
younus_rect = pygame.Rect(younus_x, younus_y, 23, 23)
younus = pygame.image.load(os.path.join("niema", "younus.png")).convert()
younus.set_colorkey((0, 0, 0))
younus = pygame.transform.scale(younus, (23, 23))
#Belt
belt_x = 340
belt_y = 200
belt_rect = pygame.Rect(belt_x, belt_y, 23, 23)
belt = pygame.image.load(os.path.join("niema", "belt.png")).convert()
belt.set_colorkey((0, 0, 0))
belt = pygame.transform.scale(belt, (26, 26))
#Secret mohan map players
#Elisa
elisa_x = 70
elisa_y = 200
elisa_rect = pygame.Rect(elisa_x, elisa_y, 32, 32)
elisa = pygame.image.load(os.path.join("secret", "elisa.png")).convert()
elisa.set_colorkey((0, 0, 0))
elisa = pygame.transform.scale(elisa, (32, 32))
#Henry L
henryl_x = 70
henryl_y = 200
henryl_rect = pygame.Rect(henryl_x, henryl_y, 23, 23)
henryl = pygame.image.load(os.path.join("secret", "henryl.png")).convert()
henryl.set_colorkey((0, 0, 0))
henryl = pygame.transform.scale(henryl, (23, 23))
#Henry X
henryx_x = 70
henryx_y = 200
henryx_rect = pygame.Rect(henryx_x, henryx_y, 23, 23)
henryx = pygame.image.load(os.path.join("secret", "henryx.png")).convert()
henryx.set_colorkey((0, 0, 255))
henryx = pygame.transform.scale(henryx, (23, 23))
#Jenelle
jenelle_x = 70
jenelle_y = 200
jenelle_rect = pygame.Rect(jenelle_x, jenelle_y, 23, 23)
jenelle = pygame.image.load(os.path.join("secret", "jenelle.png")).convert()
jenelle.set_colorkey((0, 255, 0))
jenelle = pygame.transform.scale(jenelle, (23, 23))
#Lindsey
lindsey_x = 70
lindsey_y = 200
lindsey_rect = pygame.Rect(lindsey_x, lindsey_y, 23, 23)
lindsey = pygame.image.load(os.path.join("secret", "lindsey.png")).convert()
lindsey.set_colorkey((0, 0, 0))
lindsey = pygame.transform.scale(lindsey, (23, 23))
#Tristin
tristin_x = 70
tristin_y = 200
tristin_rect = pygame.Rect(tristin_x, tristin_y, 23, 23)
tristin = pygame.image.load(os.path.join("secret", "tristin.png")).convert()
tristin.set_colorkey((0, 255, 0))
tristin = pygame.transform.scale(tristin, (23, 23))
#Prothit
prothit_x = 70
prothit_y = 200
prothit_rect = pygame.Rect(prothit_x, prothit_y, 23, 23)
prothit = pygame.image.load(os.path.join("secret", "prothit.png")).convert()
prothit.set_colorkey((0, 0, 255))
prothit = pygame.transform.scale(prothit, (23, 23))
#Nikki
nikki_x = 70
nikki_y = 200
nikki_rect = pygame.Rect(nikki_x, nikki_y, 23, 23)
nikki = pygame.image.load(os.path.join("secret", "nikki.png")).convert()
nikki.set_colorkey((0, 255, 0))
nikki = pygame.transform.scale(nikki, (23, 23))
#Yukati
yukati_x = 70
yukati_y = 200
yukati_rect = pygame.Rect(yukati_x, yukati_y, 23, 23)
yukati = pygame.image.load(os.path.join("secret", "yukati.png")).convert()
yukati.set_colorkey((0, 255, 0))
yukati = pygame.transform.scale(yukati, (23, 23))
#Mohan
mplayer_x = 220
mplayer_y = 165
mplayer_rect = pygame.Rect(mplayer_x, mplayer_y, 10, 10)
mplayer = pygame.image.load(os.path.join("secret", "mohan.png")).convert()
mplayer.set_colorkey((255, 255, 255))
mplayer = pygame.transform.scale(mplayer, (23, 23))
mohan_x = 220
mohan_y = 165
mohan_rect = pygame.Rect(mohan_x, mohan_y, 23, 23)
mohan = pygame.image.load(os.path.join("secret", "mohan.png")).convert()
mohan.set_colorkey((255, 255, 255))
mohan = pygame.transform.scale(mohan, (23, 23))
#John
john_x = 285
john_y = 200
john_rect = pygame.Rect(john_x, john_y, 23, 23)
john = pygame.image.load(os.path.join("secret", "john.png")).convert()
john.set_colorkey((0, 255, 0))
john = pygame.transform.scale(john, (23, 23))
#Points
#Star sprites
starsprite = pygame.image.load(os.path.join("curt","star.png")).convert_alpha()
starsprite = pygame.transform.scale(starsprite, (15, 15))
#Hat sprites
hatsprite = pygame.image.load(os.path.join("curt", "hat.png")).convert_alpha()
hatsprite = pygame.transform.scale(hatsprite, (20, 20))
#Wine glasses
corksprite = pygame.image.load(os.path.join("gary","cork.png")).convert_alpha()
corksprite = pygame.transform.scale(corksprite, (15, 20))
#Wine bottles
winesprite = pygame.image.load(os.path.join("gary","wine1.png")).convert_alpha()
winesprite = pygame.transform.scale(winesprite, (10, 30))
winesprite2 = pygame.image.load(os.path.join("gary","wine2.png")).convert_alpha()
winesprite2 = pygame.transform.scale(winesprite2, (10, 30))
#Lord of the Rings rings
ringsprite = pygame.image.load(os.path.join("niema","ring.png")).convert_alpha()
ringsprite = pygame.transform.scale(ringsprite, (15, 15))
#Boba Drinks
bobasprite = pygame.image.load(os.path.join("niema", "boba.png")).convert_alpha()
bobasprite = pygame.transform.scale(bobasprite, (25, 25))
mentor_list = [
player_rect, hannah_rect, jonny_rect, josh_rect, michael_rect,
gplayer_rect, diego_rect, akshat_rect, nplayer_rect, younus_rect,
elisa_rect, henryl_rect, henryx_rect, jenelle_rect, lindsey_rect,
tristin_rect, prothit_rect, nikki_rect, yukati_rect, john_rect
]
#Classes - Blueprint of an object
#Object is code representation of a real life thing
#Classes == Factories
#Class(dog) -> can make lots of dogs on a whim
#Just call for the dog richard = dog
from time import sleep, time
from home import homescreen
#From the home.py module import homescreen function
from curt import curt, c_walls, c10points, c50points
from gary import gary, g_walls, g10points, g50points
from niema import niema, n_walls, n10points, n50points
from lose_page import lose_page
from win_page import win_page
from directory import directory
from secret import secret, m_walls
clock = pygame.time.Clock()
#This helps the program keep track of time
running = True
FPS = 120
in_home = True
state = "home"
loaded = False
direction = "stop"
#First zero = direction
#Second zero = steps
younus_variable = [0, 0]
belt_variable = [0, 0]
niema_enemy_variable = [younus_variable, belt_variable]
akshat_variable = [0, 0]
diego_variable = [0, 0]
clock_variable = [0, 0]
gary_enemy_variable = [akshat_variable, diego_variable, clock_variable]
hannah_variable = [0, 0]
josh_variable = [0, 0]
michael_variable = [0, 0]
jonny_variable = [0, 0]
curt_enemy_variable = [
hannah_variable, josh_variable, michael_variable, jonny_variable
]
while running:
clock.tick(FPS)
if state == "home":
#Want some way to keep track of what page you are in -> dont want to be in the menu anymore if don't need it
#Curt's point lists
star_list = c10points(screen_length, screen_height, dim_field, screen,
player_rect)
hat_list = c50points(screen_length, screen_height, dim_field, screen,
player_rect)
#Gary's point lists
cork_list = g10points(screen_length, screen_height, dim_field, screen,
player_rect)
wine_list = g50points(screen_length, screen_height, dim_field, screen,
player_rect)
#Niema's point lists
ring_list = n10points(screen_length, screen_height, dim_field, screen,
player_rect)
boba_list = n50points(screen_length, screen_height, dim_field, screen,
player_rect)
#Niema's enemy list
niema_enemy = [younus_rect, belt_rect]
#Gary's enemy list
gary_enemy = [diego_rect, aclock_rect, akshat_rect]
#Curt's enemy list
curt_enemy = [hannah_rect, michael_rect, jonny_rect, josh_rect]
num_points = 0
num_lives = 3
#Curt's starting point:
player_rect.left = player_x
player_rect.top = player_y
#Hannah's starting point:
hannah_rect.left = hannah_x
hannah_rect.top = hannah_y
#Jonny's starting point:
jonny_rect.left = jonny_x
jonny_rect.top = jonny_y
#Michael's starting point:
michael_rect.left = michael_x
michael_rect.top = michael_y
#Josh's starting point:
josh_rect.left = josh_x
josh_rect.top = josh_y
#Gary's starting point:
gplayer_rect.left = gplayer_x
gplayer_rect.top = gplayer_y
#Diego's starting point:
diego_rect.left = diego_x
diego_rect.top = diego_y
#Akshat's starting point:
akshat_rect.left = akshat_x
akshat_rect.top = akshat_y
#Clock's starting point:
aclock_rect.left = aclock_x
aclock_rect.top = aclock_y
#Niema's starting point:
nplayer_rect.left = nplayer_x
nplayer_rect.top = nplayer_y
#Younus' starting point:
younus_rect.left = younus_x
younus_rect.top = younus_y
#Belt's starting point:
belt_rect.left = belt_x
belt_rect.top = belt_y
#Mohan's starting point:
mplayer_rect.left = mplayer_x
mplayer_rect.top = mplayer_y
direction = "none"
#Counter before player death
counter = 0
page = homescreen(screen_length, screen_height, dim_field, screen,
player_rect)
state = page
elif page == "curt":
#Calling Curt's screen
curt(screen_length, screen_height, dim_field, screen, player_rect,
num_points, num_lives)
#Calling Curt's walls
curt_walls = c_walls(screen_length, screen_height, dim_field, screen,
player_rect)
#Curt's sprites
bye_star = player_rect.collidelist(star_list)
if bye_star != -1:
star_list.remove(star_list[bye_star])
num_points += 10
for star in star_list:
screen.blit(starsprite, star)
bye_hat = player_rect.collidelist(hat_list)
if bye_hat != -1:
hat_list.remove(hat_list[bye_hat])
num_points += 50
for hat in hat_list:
screen.blit(hatsprite, hat)
if num_points == 1150:
page = "win"
bye_lives = player_rect.collidelist(curt_enemy)
if bye_lives != -1 and counter < 1:
num_lives -= 1
counter = 100
if num_lives == 1:
player_rect.left = player_x
player_rect.top = player_y
if num_lives == 2:
player_rect.left = player_x
player_rect.top = player_y
elif counter > 0:
counter -= 1
if num_lives == 0:
page = "lose"
screen.blit(player, player_rect)
screen.blit(hannah, hannah_rect)
screen.blit(jonny, jonny_rect)
screen.blit(josh, josh_rect)
screen.blit(michael, michael_rect)
#Draw the player here to continuously draw it as its moving over the frames
#Curt's player's movement
if direction == "left":
player_rect.move_ip(-2, 0)
if player_rect.collidelist(curt_walls) != -1:
player_rect.move_ip(2, 0)
elif direction == "right":
player_rect.move_ip(2, 0)
if player_rect.collidelist(curt_walls) != -1:
player_rect.move_ip(-2, 0)
elif direction == "up":
player_rect.move_ip(0, -2)
if player_rect.collidelist(curt_walls) != -1:
player_rect.move_ip(0, 2)
elif direction == "down":
player_rect.move_ip(0, 2)
if player_rect.collidelist(curt_walls) != -1:
player_rect.move_ip(0, -2)
else:
pass
#Curt Enemy movement
for enemy in range(len(curt_enemy_variable)):
curt_enemy_variable[enemy][0] #Direction
curt_enemy_variable[enemy][1] #Steps/Distance
if curt_enemy_variable[enemy][1] <= 0:
curt_enemy_variable[enemy][0] = random.randint(0, 3)
curt_enemy_variable[enemy][1] = 120
if curt_enemy_variable[enemy][0] == 0:
curt_enemy[enemy].move_ip(-2, 0) #Left
curt_enemy_variable[enemy][1] -= 2
if curt_enemy[enemy].collidelist(curt_walls) > -1:
curt_enemy[enemy].move_ip(2, 0)
curt_enemy_variable[enemy][0] = random.randint(0, 3)
curt_enemy_variable[enemy][1] = 60
elif curt_enemy_variable[enemy][0] == 1:
curt_enemy[enemy].move_ip(2, 0) #Right
curt_enemy_variable[enemy][1] -= 2
if curt_enemy[enemy].collidelist(curt_walls) > -1:
curt_enemy[enemy].move_ip(-2, 0)
curt_enemy_variable[enemy][0] = random.randint(0, 3)
curt_enemy_variable[enemy][1] = 60
elif curt_enemy_variable[enemy][0] == 2:
curt_enemy[enemy].move_ip(0, -2) #Up
curt_enemy_variable[enemy][1] -= 2
if curt_enemy[enemy].collidelist(curt_walls) > -1:
curt_enemy[enemy].move_ip(0, 2)
curt_enemy_variable[enemy][0] = random.randint(0, 3)
curt_enemy_variable[enemy][1] = 60
elif curt_enemy_variable[enemy][0] == 3:
curt_enemy[enemy].move_ip(0, 2) #Down
curt_enemy_variable[enemy][1] -= 2
if curt_enemy[enemy].collidelist(curt_walls) > -1:
curt_enemy[enemy].move_ip(0, -2)
curt_enemy_variable[enemy][0] = random.randint(0, 3)
curt_enemy_variable[enemy][1] = 60
#Curt enemy boundaries
if curt_enemy[enemy].left < 0:
curt_enemy[enemy].left = 0
if curt_enemy[enemy].right > screen_length:
curt_enemy[enemy].right = screen_length
if curt_enemy[enemy].bottom > 340:
curt_enemy[enemy].bottom = 340
if curt_enemy[enemy].top < 30:
curt_enemy[enemy].top = 30
elif page == "gary":
#Gary's screen is called
gary(screen_length, screen_height, dim_field, screen, gplayer_rect,
num_points, num_lives)
#Walls get set up
gary_walls = g_walls(screen_length, screen_height, dim_field, screen,
gplayer_rect)
#Gary's points
bye_cork = gplayer_rect.collidelist(cork_list)
if bye_cork != -1:
cork_list.remove(cork_list[bye_cork])
num_points += 10
for cork in cork_list:
screen.blit(corksprite, cork)
bye_wine = gplayer_rect.collidelist(wine_list)
if bye_wine != -1:
wine_list.remove(wine_list[bye_wine])
num_points += 50
for wine in wine_list:
screen.blit(winesprite, wine)
bye_wine2 = gplayer_rect.collidelist(wine_list)
if bye_wine2 != -1:
wine_list.remove(wine_list[bye_wine2])
num_points += 50
for wine in wine_list:
screen.blit(winesprite2, wine)
if num_points == 800:
page = "win"
#Gary's lives
bye_lives = gplayer_rect.collidelist(gary_enemy)
if bye_lives != -1 and counter < 1:
num_lives -= 1
counter = 100
if num_lives == 1:
gplayer_rect.left = gplayer_x
gplayer_rect.top = gplayer_y
if num_lives == 2:
gplayer_rect.left = gplayer_x
gplayer_rect.top = gplayer_y
elif counter > 0:
counter -= 1
if num_lives == 0:
page = "lose"
#Blitting all of Gary's sprites
screen.blit(gplayer, gplayer_rect)
screen.blit(diego, diego_rect)
screen.blit(aclock, aclock_rect)
screen.blit(akshat, akshat_rect)
#Gary's movement
if direction == "left":
gplayer_rect.move_ip(-1, 0)
if gplayer_rect.collidelist(gary_walls) != -1:
gplayer_rect.move_ip(1, 0)
elif direction == "right":
gplayer_rect.move_ip(1, 0)
if gplayer_rect.collidelist(gary_walls) != -1:
gplayer_rect.move_ip(-1, 0)
elif direction == "up":
gplayer_rect.move_ip(0, -1)
if gplayer_rect.collidelist(gary_walls) != -1:
gplayer_rect.move_ip(0, 1)
elif direction == "down":
gplayer_rect.move_ip(0, 1)
if gplayer_rect.collidelist(gary_walls) != -1:
gplayer_rect.move_ip(0, -1)
else:
pass
#Gary Enemy movement
for enemy in range(len(gary_enemy_variable)):
gary_enemy_variable[enemy][0] #Direction
gary_enemy_variable[enemy][1] #Steps/Distance
if gary_enemy_variable[enemy][1] <= 0:
gary_enemy_variable[enemy][0] = random.randint(0, 3)
gary_enemy_variable[enemy][1] = 60
if gary_enemy_variable[enemy][0] == 0:
gary_enemy[enemy].move_ip(-1, 0) #Left
gary_enemy_variable[enemy][1] -= 2
if gary_enemy[enemy].collidelist(gary_walls) > -1:
gary_enemy[enemy].move_ip(1, 0)
gary_enemy_variable[enemy][0] = random.randint(0, 3)
gary_enemy_variable[enemy][1] = 60
elif gary_enemy_variable[enemy][0] == 1:
gary_enemy[enemy].move_ip(1, 0) #Right
gary_enemy_variable[enemy][1] -= 2
if gary_enemy[enemy].collidelist(gary_walls) > -1:
gary_enemy[enemy].move_ip(-1, 0)
gary_enemy_variable[enemy][0] = random.randint(0, 3)
gary_enemy_variable[enemy][1] = 60
elif gary_enemy_variable[enemy][0] == 2:
gary_enemy[enemy].move_ip(0, -1) #Up
gary_enemy_variable[enemy][1] -= 2
if gary_enemy[enemy].collidelist(gary_walls) > -1:
gary_enemy[enemy].move_ip(0, 1)
gary_enemy_variable[enemy][0] = random.randint(0, 3)
gary_enemy_variable[enemy][1] = 60
elif gary_enemy_variable[enemy][0] == 3:
gary_enemy[enemy].move_ip(0, 1) #Down
gary_enemy_variable[enemy][1] -= 2
if gary_enemy[enemy].collidelist(gary_walls) > -1:
gary_enemy[enemy].move_ip(0, -1)
gary_enemy_variable[enemy][0] = random.randint(0, 3)
gary_enemy_variable[enemy][1] = 60
#Gary enemy boundaries, Shift tab makes it unindent
if gary_enemy[enemy].left < 0:
gary_enemy[enemy].left = 0
if gary_enemy[enemy].right > screen_length:
gary_enemy[enemy].right = screen_length
if gary_enemy[enemy].bottom > 340:
gary_enemy[enemy].bottom = 340
if gary_enemy[enemy].top < 30:
gary_enemy[enemy].top = 30
elif page == "niema":
#Calling Niema's screen
niema(screen_length, screen_height, dim_field, screen, nplayer_rect,
num_points, num_lives)
#Calling Niema's walls
niema_walls = n_walls(screen_length, screen_height, dim_field, screen,
player_rect)
#Niema's points
bye_ring = nplayer_rect.collidelist(ring_list)
if bye_ring != -1:
ring_list.remove(ring_list[bye_ring])
num_points += 10
for ring in ring_list:
screen.blit(ringsprite, ring)
bye_boba = nplayer_rect.collidelist(boba_list)
if bye_boba != -1:
boba_list.remove(boba_list[bye_boba])
num_points += 50
for boba in boba_list:
screen.blit(bobasprite, boba)
if num_points == 650:
# Pauses at 640 points, but we want them to see how many points they earned
# started = time()
# sleep(5)
# ended = time()
page = "win"
#Niema's number of lives
bye_lives = nplayer_rect.collidelist(niema_enemy)
#Neima's enemies are Younus and a belt
if bye_lives != -1 and counter < 1:
# niema_enemy.remove(niema_enemy[bye_lives])
num_lives -= 1
counter = 100
if num_lives == 1:
nplayer_rect.left = nplayer_x
nplayer_rect.top = nplayer_y
if num_lives == 2:
nplayer_rect.left = nplayer_x
nplayer_rect.top = nplayer_y
elif counter > 0:
counter -= 1
if num_lives == 0:
page = "lose"
#Niema's sprites
screen.blit(nplayer, nplayer_rect)
screen.blit(younus, younus_rect)
screen.blit(belt, belt_rect)
#Niema's movement
if direction == "left":
nplayer_rect.move_ip(-2, 0)
if nplayer_rect.collidelist(niema_walls) != -1:
nplayer_rect.move_ip(2, 0)
elif direction == "right":
nplayer_rect.move_ip(2, 0)
if nplayer_rect.collidelist(niema_walls) != -1:
nplayer_rect.move_ip(-2, 0)
elif direction == "up":
nplayer_rect.move_ip(0, -2)
if nplayer_rect.collidelist(niema_walls) != -1:
nplayer_rect.move_ip(0, 2)
elif direction == "down":
nplayer_rect.move_ip(0, 2)
if nplayer_rect.collidelist(niema_walls) != -1:
nplayer_rect.move_ip(0, -2)
else:
pass
# print(len(niema_enemy_variable[0]))
#Niema Enemy movement
for enemy in range(len(niema_enemy_variable)):
niema_enemy_variable[enemy][0] #Direction
niema_enemy_variable[enemy][1] #Steps/Distance
if niema_enemy_variable[enemy][1] <= 0:
niema_enemy_variable[enemy][0] = random.randint(0, 3)
niema_enemy_variable[enemy][1] = 60
if niema_enemy_variable[enemy][0] == 0:
niema_enemy[enemy].move_ip(-2, 0) #Left
niema_enemy_variable[enemy][1] -= 2
if niema_enemy[enemy].collidelist(niema_walls) > -1:
niema_enemy[enemy].move_ip(2, 0)
niema_enemy_variable[enemy][0] = random.randint(0, 3)
niema_enemy_variable[enemy][1] = 60
elif niema_enemy_variable[enemy][0] == 1:
niema_enemy[enemy].move_ip(2, 0) #Right
niema_enemy_variable[enemy][1] -= 2
if niema_enemy[enemy].collidelist(niema_walls) > -1:
niema_enemy[enemy].move_ip(-2, 0)
niema_enemy_variable[enemy][0] = random.randint(0, 3)
niema_enemy_variable[enemy][1] = 60
elif niema_enemy_variable[enemy][0] == 2:
niema_enemy[enemy].move_ip(0, -2) #Up
niema_enemy_variable[enemy][1] -= 2
if niema_enemy[enemy].collidelist(niema_walls) > -1:
niema_enemy[enemy].move_ip(0, 2)
niema_enemy_variable[enemy][0] = random.randint(0, 3)
niema_enemy_variable[enemy][1] = 60
elif niema_enemy_variable[enemy][0] == 3:
niema_enemy[enemy].move_ip(0, 2) #Down
niema_enemy_variable[enemy][1] -= 2
if niema_enemy[enemy].collidelist(niema_walls) > -1:
niema_enemy[enemy].move_ip(0, -2)
niema_enemy_variable[enemy][0] = random.randint(0, 3)
niema_enemy_variable[enemy][1] = 60
#Niema enemy boundaries, Shift tab makes it unindent
if niema_enemy[enemy].left < 0:
niema_enemy[enemy].left = 0
if niema_enemy[enemy].right > screen_length:
niema_enemy[enemy].right = screen_length
if niema_enemy[enemy].bottom > 340:
niema_enemy[enemy].bottom = 340
if niema_enemy[enemy].top < 30:
niema_enemy[enemy].top = 30
elif page == "secret":
secretpage = secret(screen_length, screen_height, dim_field, screen, mplayer_rect, quote)
# print(secretpage)
if secretpage != "secret":
state = "home"
#Mohan's walls
mohan_walls = m_walls(screen_length, screen_height, dim_field, screen,
mplayer_rect)
#Mohan blit
screen.blit(mplayer, mplayer_rect)
#Top Row
#Diego's starting point:
diego_rect.left = 65
diego_rect.top = 55
#Hannah's starting point:
hannah_rect.left = 128
hannah_rect.top = 55
#Jonny's starting point:
jonny_rect.left = 191
jonny_rect.top = 55
#Michael's starting point:
michael_rect.left = 254
michael_rect.top = 55
#Josh's starting point:
josh_rect.left = 317
josh_rect.top = 55
#Akshat's starting point:
akshat_rect.left = 380
akshat_rect.top = 55
#Bottom row
#Younus' starting point:
younus_rect.left = 65
younus_rect.top = 240
#Elisa
elisa_rect.left = 128
elisa_rect.top = 235
#Henry L
henryl_rect.left = 191
henryl_rect.top = 242
#Jenelle
jenelle_rect.left = 254
jenelle_rect.top = 240
#Lindsey
lindsey_rect.left = 317
lindsey_rect.top = 240
#Tristin
tristin_rect.left = 380
tristin_rect.top = 240
#Top of first 2:
#Curt's starting point:
player_rect.left = 50
player_rect.top = 125
#Top of second 2:
#Gary's starting point:
gplayer_rect.left = 255
gplayer_rect.top = 125
#Top of 5:
#Niema's starting point:
nplayer_rect.left = 380
nplayer_rect.top = 125
#Bottom of first 2
#John
john_rect.left = 70
john_rect.top = 170
#Bottom of second 2
#Prothit
prothit_rect.left = 275
prothit_rect.top = 170
#Bottom of 5
#Henry X
henryx_rect.left = 370
henryx_rect.top = 170
#Left of first 2
#Nikki
nikki_rect.left = 10
nikki_rect.top = 165
#Right of 5
#Yukati
yukati_rect.left = 430
yukati_rect.top = 165
#Blitting
screen.blit(player, player_rect)
screen.blit(hannah, hannah_rect)
screen.blit(jonny, jonny_rect)
screen.blit(josh, josh_rect)
screen.blit(michael, michael_rect)
screen.blit(gplayer, gplayer_rect)
screen.blit(diego, diego_rect)
screen.blit(akshat, akshat_rect)
screen.blit(nplayer, nplayer_rect)
screen.blit(younus, younus_rect)
screen.blit(elisa, elisa_rect)
screen.blit(henryl, henryl_rect)
screen.blit(henryx, henryx_rect)
screen.blit(jenelle, jenelle_rect)
screen.blit(lindsey, lindsey_rect)
screen.blit(tristin, tristin_rect)
screen.blit(prothit, prothit_rect)
screen.blit(nikki, nikki_rect)
screen.blit(yukati, yukati_rect)
screen.blit(john, john_rect)
#Mohan's movement
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
mplayer_rect.move_ip(-3, 0)
if mplayer_rect.collidelist(mohan_walls) != -1:
mplayer_rect.move_ip(3, 0)
if keys[pygame.K_RIGHT]:
mplayer_rect.move_ip(2, 0)
if mplayer_rect.collidelist(mohan_walls) != -1:
mplayer_rect.move_ip(-3, 0)
if keys[pygame.K_UP]:
mplayer_rect.move_ip(0, -3)
if mplayer_rect.collidelist(mohan_walls) != -1:
mplayer_rect.move_ip(0, 3)
if keys[pygame.K_DOWN]:
mplayer_rect.move_ip(0, 3)
if mplayer_rect.collidelist(mohan_walls) != -1:
mplayer_rect.move_ip(0, -3)
else:
pass
#Quote
print_quote = mplayer_rect.collidelist(mentor_list)
if print_quote != -1:
#print_quote gives us the index of the mentor on the list and we want the quote to change to the corresponding quote in the quote list
quote = quote_list[print_quote]
elif page == "directory":
state = directory(screen_length, screen_height, dim_field, screen)
if state == "secret":
page = state
state = page
#Curt's starting point:
player_rect.left = 115
player_rect.top = 55
#Hannah's starting point:
hannah_rect.left = 115
hannah_rect.top = 85
#Jonny's starting point:
jonny_rect.left = 115
jonny_rect.top = 115
#Michael's starting point:
michael_rect.left = 115
michael_rect.top = 175
#Josh's starting point:
josh_rect.left = 115
josh_rect.top = 145
#Gary's starting point:
gplayer_rect.left = 265
gplayer_rect.top = 55
#Diego's starting point:
diego_rect.left = 265
diego_rect.top = 85
#Akshat's starting point:
akshat_rect.left = 265
akshat_rect.top = 115
#John
john_rect.left = 265
john_rect.top = 145
#Younus' starting point:
younus_rect.left = 265
younus_rect.top = 175
#Elisa
elisa_rect.left = 260
elisa_rect.top = 205
#Henry L
henryl_rect.left = 265
henryl_rect.top = 237
#Jenelle
jenelle_rect.left = 115
jenelle_rect.top = 205
#Lindsey
lindsey_rect.left = 115
lindsey_rect.top = 235
#Niema's starting point:
nplayer_rect.left = 415
nplayer_rect.top = 55
#Mohan
mohan_rect.left = 415
mohan_rect.top = 85
#Tristin
tristin_rect.left = 415
tristin_rect.top = 115
#Prothit
prothit_rect.left = 415
prothit_rect.top = 145
#Henry X
henryx_rect.left = 415
henryx_rect.top = 175
#Nikki
nikki_rect.left = 415
nikki_rect.top = 205
#Yukati
yukati_rect.left = 415
yukati_rect.top = 235
#Blitting
screen.blit(player, player_rect)
screen.blit(hannah, hannah_rect)
screen.blit(jonny, jonny_rect)
screen.blit(josh, josh_rect)
screen.blit(michael, michael_rect)
screen.blit(gplayer, gplayer_rect)
screen.blit(diego, diego_rect)
screen.blit(akshat, akshat_rect)
screen.blit(nplayer, nplayer_rect)
screen.blit(younus, younus_rect)
screen.blit(elisa, elisa_rect)
screen.blit(henryl, henryl_rect)
screen.blit(henryx, henryx_rect)
screen.blit(jenelle, jenelle_rect)
screen.blit(lindsey, lindsey_rect)
screen.blit(tristin, tristin_rect)
screen.blit(prothit, prothit_rect)
screen.blit(nikki, nikki_rect)
screen.blit(yukati, yukati_rect)
screen.blit(mohan, mohan_rect)
screen.blit(john, john_rect)
#Need to figure out if possible to update x and y coordinates for rectangle
elif page == "win":
#win/lose page is called