-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame.py
1125 lines (1084 loc) · 50.6 KB
/
Game.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 ctypes
import os
import pygame
from screeninfo import get_monitors
import Orden
import Necro
import NatureProtection
import ShadowLeague
import Inferno
import Mage
from Orden import FirstCreature, SecondCreature, ThirdCreature, \
FourthCreature, FifthCreature, SixthCreature, SeventhCreature
from Necro import FirstCreature, SecondCreature, ThirdCreature, \
FourthCreature, FifthCreature, SixthCreature, SeventhCreature
from NatureProtection import FirstCreature, SecondCreature, ThirdCreature, \
FourthCreature, FifthCreature, SixthCreature, SeventhCreature
from ShadowLeague import FirstCreature, SecondCreature, ThirdCreature, \
FourthCreature, FifthCreature, SixthCreature, SeventhCreature
from Inferno import FirstCreature, SecondCreature, ThirdCreature, \
FourthCreature, FifthCreature, SixthCreature, SeventhCreature
from Mage import FirstCreature, SecondCreature, ThirdCreature, \
FourthCreature, FifthCreature, SixthCreature, SeventhCreature
window = None
fullscreen = False
def draw_button(colour: tuple, coordinates: tuple, name: str, font: int = 40):
"""
:param font: Font of text
:param colour: background colour
:param coordinates: where should button be placed
:param name: Button name
:return: None
Prints button in correct place
"""
global window
pygame.draw.rect(window, colour,
(coordinates[0],
coordinates[1],
coordinates[2],
coordinates[3]))
fond = pygame.font.Font(None, 40)
text = fond.render(name, True, [0, 0, 0])
window.blit(text, [coordinates[0] + coordinates[2] // 100 + 1, coordinates[
1] + coordinates[3] // 100 + 1])
def draw_some_buttons(count: int, names: list, paper_size: tuple):
"""
:param count: Count of buttons that should be drawn
:param names: list of names of buttons
:param paper_size: size of menu
:return: coordinats of all buttons
"""
answer = []
for number in range(count):
draw_button((128, 0, 0),
(paper_size[0] + 20,
paper_size[1] + 20 + 10 * number + number *
(paper_size[3] - 40 - 10 * (count - 1)) // count,
paper_size[2] - 40,
(paper_size[3] - 40 - 10 * (count - 1)) // count),
names[number])
answer += [(paper_size[0] + 20,
paper_size[1] + 20 + 10 * number + number *
(paper_size[3] - 40 - 10 * (count - 1)) // count,
paper_size[2] - 40,
(paper_size[3] - 40 - 10 * (count - 1)) // count)]
return answer
def create_window_of_the_same_size():
"""
:return: nothing
This function is used to create window of already chosen size
"""
size = [pygame.display.get_surface().get_width(),
pygame.display.get_surface().get_height()]
global window
global fullscreen
if fullscreen:
window = pygame.display.set_mode((size[0], size[1]), pygame.FULLSCREEN)
else:
window = pygame.display.set_mode((size[0], size[1]))
if os.name == "nt":
background_image = pygame.image.load(str(os.path.abspath(
__file__)).split("Game")[0] + str(size[0]) + "x" + str(size[1])
+ ".jpg")
else:
background_image = pygame.image.load(
str(size[0]) + "x" + str(size[1]) +
".jpg")
window.blit(background_image, [0, 0])
pygame.display.set_caption("Герои меча и магии(Arthur's and Anastasia's "
"remake)")
def create_window(length: int = 800, width: int = 600):
"""
:param length: Length of screen
:param width: Width of screen
:return: array of buttons
Creating window of game(depends on format)
Make main buttons
"""
if os.name == "nt":
user32 = ctypes.windll.user32
current_w = user32.GetSystemMetrics(0)
current_h = user32.GetSystemMetrics(1)
background_image = pygame.image.load(
str(os.path.abspath(__file__)).split(
"Game")[0] + str(length) + "x" + str(width) + ".jpg")
else:
info_object = str(get_monitors()).split("=")
current_w = int(info_object[3].split(",")[0])
current_h = int(info_object[4].split(",")[0])
background_image = pygame.image.load(str(length) + "x" + str(width) +
".jpg")
if current_w < length or current_h < width:
print("you can't choose that. Default was set")
length = 800
width = 600
if os.name == "nt":
background_image = pygame.image.load(
str(os.path.abspath(__file__)).split(
"Game")[0] + str(length) + "x" + str(width) + ".jpg")
else:
background_image = pygame.image.load(
str(length) + "x" + str(width) +
".jpg")
global window
global fullscreen
if fullscreen:
window = pygame.display.set_mode((length, width),
pygame.HWSURFACE | pygame.FULLSCREEN)
else:
window = pygame.display.set_mode((length, width))
window.blit(background_image, [0, 0])
pygame.display.set_caption("Герои меча и магии(Arthur's and Anastasia's "
"remake)")
pygame.draw.rect(window,
(205, 133, 63),
(length // 3, width // 3, length // 3, width // 3))
buttons = draw_some_buttons(4, ["Start playing", "Options", "Information",
"Exit"],
(length // 3, width // 3, length // 3,
width // 3))
pygame.display.update()
return buttons
def start_menu():
"""
:return: array of buttons on start menu
Creating start menu
"""
size = [pygame.display.get_surface().get_width(),
pygame.display.get_surface().get_height()]
create_window_of_the_same_size()
fond = pygame.font.Font(None, 40)
text = fond.render("Coming soon", True, [0, 0, 0])
window.blit(text, [size[0] // 3 + 24, size[1] // 3])
draw_button((128, 0, 0),
(size[0] // 3 + 24,
size[1] // 3 + 50 + 3 * (
size[1] // 3 - 70) // 4,
size[0] // 3 - 50,
(size[1] // 3 - 70) // 4),
"Return to main")
pygame.display.update()
return [(size[0] // 3 + 24,
size[1] // 3 + 50 + 3 * (size[1] // 3 - 70) // 4,
size[0] // 3 - 50,
(size[1] // 3 - 70) // 4)]
def option_menu():
"""
:return: array of option's buttons
"""
size_of_options = [pygame.display.get_surface().get_width(),
pygame.display.get_surface().get_height()]
create_window_of_the_same_size()
length = size_of_options[0]
width = size_of_options[1]
pygame.draw.rect(window,
(205, 133, 63),
(length // 3,
width // 5,
length // 3,
2 * width // 5 + (2 * width // 5 - 90) // 6 + 20))
if os.name == "nt":
user32 = ctypes.windll.user32
current_w = user32.GetSystemMetrics(0)
current_h = user32.GetSystemMetrics(1)
else:
info_object = str(get_monitors()).split("=")
current_w = int(info_object[3].split(",")[0])
current_h = int(info_object[4].split(",")[0])
button_names = []
button_name = "800x600"
if current_w < 800 or current_h < 600:
button_name += "*"
button_names += [button_name]
button_name = "1178x663"
if current_w < 1178 or current_h < 663:
button_name += "*"
button_names += [button_name]
button_name = "1280x720"
if current_w < 1280 or current_h < 720:
button_name += "*"
button_names += [button_name]
button_name = "1920x1080"
if current_w < 1920 or current_h < 1080:
button_name += "*"
button_names += [button_name]
button_name = "1600x800"
if current_w < 1600 or current_h < 800:
button_name += "*"
button_names += [button_name]
button_names += ["Fullscreen", "Return"]
buttons = draw_some_buttons(len(button_names), button_names,
(length // 3,
width // 5,
length // 3,
2 * width // 5 + (
2 * width // 5 - 90) // 6 + 20))
fond = pygame.font.Font(None, 40)
text = fond.render("* means you can't choose this parametr", True,
[255, 255, 255])
window.blit(text, [length // 4, width - 40])
pygame.display.update()
return buttons
def information_menu():
"""
:return: information buttons
Create information window
"""
create_window_of_the_same_size()
length = pygame.display.get_surface().get_width()
width = pygame.display.get_surface().get_height()
pygame.draw.rect(window,
(205, 133, 63),
(length // 3,
width // 3,
length // 3,
width // 3))
buttons = draw_some_buttons(4, ["Heroes", "Spells", "Units", "Return"],
(length // 3,
width // 3,
length // 3,
width // 3))
pygame.display.update()
return buttons
def spell_menu():
"""
:return: spell menu buttons
Create a spell menu
"""
create_window_of_the_same_size()
length = pygame.display.get_surface().get_width()
width = pygame.display.get_surface().get_height()
pygame.draw.rect(window,
(205, 133, 63),
(length // 3,
width // 3,
length // 3,
width // 3))
buttons = draw_some_buttons(5, ["Dark", "Destructive", "Light",
"Summoning", "Return"],
(length // 3,
width // 3,
length // 3,
width // 3))
pygame.display.update()
return buttons
def choose_class_display():
"""
:return: buttons of choosing class
Create a window to choose class
"""
create_window_of_the_same_size()
length = pygame.display.get_surface().get_width()
width = pygame.display.get_surface().get_height()
pygame.draw.rect(window,
(205, 133, 63),
(3 * length // 8,
width // 5,
3 * length // 8,
3 * width // 5))
buttons = draw_some_buttons(7, ["Orden",
"Necropolis",
"Inferno",
"Nature Protection",
"Shadow League",
"Mage",
"Return"],
(3 * length // 8,
width // 5,
3 * length // 8,
3 * width // 5))
pygame.display.update()
return buttons
def show_heroes(class_name: str):
"""
:param class_name: Witch class should be shown
:return: buttons coordinates
Create Hero menu
"""
create_window_of_the_same_size()
length = pygame.display.get_surface().get_width()
width = pygame.display.get_surface().get_height()
hero_list = []
if class_name == "Orden":
hero_list = ["Swerchok", "Ivanhoe"]
elif class_name == "Necropolis":
hero_list = ["Markel", "Tiamovax"]
elif class_name == "Mage":
hero_list = ["Orra", "Zexir"]
elif class_name == "Shadow League":
hero_list = ["Railag", "Shadia"]
elif class_name == "Nature Protection":
hero_list = ["Faidaen", "Legolas"]
elif class_name == "Inferno":
hero_list = ["Agrail", "Shacherizada"]
else:
print("Something went wrong. Please, tell Anastasia Kemova about that "
"[email protected] (wrong classname)")
pygame.draw.rect(window,
(205, 133, 63),
(length // 3,
width // 3,
length // 3,
width // 3))
buttons = draw_some_buttons(2, hero_list,
(length // 3,
width // 3,
length // 3,
2 * width // 9))
buttons += draw_some_buttons(1, ["Return"],
(length // 3,
width // 3 - 30 + 2 * width // 9,
length // 3,
width // 9 + 15))
pygame.display.update()
return buttons
def show_units(class_name: str):
"""
:param class_name: what class should be shown
:return: buttons for units
Create menu for information of Creatures
"""
create_window_of_the_same_size()
length = pygame.display.get_surface().get_width()
width = pygame.display.get_surface().get_height()
unit_list = []
if class_name == "Orden":
unit_list = ["Villager",
"Archer",
"Footman",
"Griffin",
"Priest",
"Cavalier",
"Angel",
"Conscript",
"Marksman",
"Squire",
"Imperial Griffin",
"Inquisitor",
"Paladin",
"Archangel"]
elif class_name == "Necropolis":
unit_list = ["Skeleton",
"Zombie",
"Ghost",
"Vampire",
"Lich",
"Wight",
"Bone Dragon",
"Skeleton Archer",
"Plague Zombie",
"Spectre",
"Vampire Lord",
"Archlich",
"Wraith",
"Spectral Dragon"]
elif class_name == "Mage":
unit_list = ["Gremlin",
"Stone Gargoyle",
"Iron Golem",
"Mage",
"Djinn",
"Rakshasa Rani",
"Colossus",
"Master Gremlin",
"Obsidian Gargoyle",
"Steel Golem",
"Archmage",
"Djinn Sultan",
"Rakshasa Raja",
"Titan"]
elif class_name == "Shadow League":
unit_list = ["Scout",
"Blood Maiden",
"Minotaur",
"Dark Rider",
"Hydra",
"Shadow Witch",
"Shadow Dragon",
"Assassin",
"Blood Fury",
"Minotaur Guard",
"Grim Rider",
"Deep Hydra",
"Shadow Matriarch",
"Black Dragon"]
elif class_name == "Nature Protection":
unit_list = ["Pixie",
"Blade Dancer",
"Hunter",
"Druid",
"Unicorn",
"Treant",
"Green Dragon",
"Sprite",
"War Dancer",
"Master Hunter",
"Druid Elder",
"Silver Unicorn",
"Ancien Treant",
"Emerald Dragon"]
elif class_name == "Inferno":
unit_list = ["Imp",
"Horned Demon",
"Hell Hound",
"Succubus",
"Hell Charger",
"Pit Fiend",
"Devil",
"Familiar",
"Horned Overseer",
"Cerberus",
"Succubus Mistress",
"Nightmare",
"Pit Lord",
"Arch Devil"]
else:
print("Something went wrong. Please, tell Anastasia Kemova about that "
"[email protected] (wrong classname)")
pygame.draw.rect(window,
(205, 133, 63),
(length // 8,
width // 5,
3 * length // 4,
3 * width // 5 + 3 * width // 35))
buttons = draw_some_buttons(7, unit_list[:7],
(length // 8,
width // 5,
3 * length // 8,
3 * width // 5))
buttons += draw_some_buttons(7, unit_list[7:],
(length // 2,
width // 5,
3 * length // 8,
3 * width // 5))
buttons += draw_some_buttons(1, ["Return"],
(length // 3,
4 * width // 5 - 30,
length // 3,
width // 7))
pygame.display.update()
return buttons, unit_list
def show_unit(unit_name: str):
"""
:param unit_name: what unit should be shown
:return: return button
shows information about units
"""
global opened_catalog
global array_of_Orden, array_of_Necro, array_of_Mage, array_of_Forest, \
array_of_Inferno, array_of_Shadows
position = 0
if opened_catalog == Orden:
position = array_of_Orden.index(unit_name)
elif opened_catalog == Necro:
position = array_of_Necro.index(unit_name)
elif opened_catalog == NatureProtection:
position = array_of_Forest.index(unit_name)
elif opened_catalog == Mage:
position = array_of_Mage.index(unit_name)
elif opened_catalog == Inferno:
position = array_of_Inferno.index(unit_name)
elif opened_catalog == ShadowLeague:
position = array_of_Shadows.index(unit_name)
create_window_of_the_same_size()
length = pygame.display.get_surface().get_width()
width = pygame.display.get_surface().get_height()
if os.name == "nt":
background_image_of_unit = pygame.image.load(
str(os.path.abspath(__file__)).split(
"Game")[0] + "заготовка.png")
else:
background_image_of_unit = pygame.image.load("заготовка.png")
window.blit(background_image_of_unit, [0, 0])
draw_button((128, 0, 0), (length - 200, width - width // 10, 170, 100),
"Return")
if os.name == "nt":
background_image_of_unit_face = pygame.image.load(
str(os.path.abspath(__file__)).split(
"Game")[0] + unit_name + ".png")
else:
background_image_of_unit_face = pygame.image.load(unit_name + ".png")
window.blit(background_image_of_unit_face, [40, 60])
if position // 7 == 1:
if position % 7 == 0:
creature = opened_catalog.FirstCreature.FirstNotUpgraded
elif position % 7 == 1:
creature = opened_catalog.SecondCreature.SecondNotUpgraded
elif position % 7 == 2:
creature = opened_catalog.ThirdCreature.ThirdNotUpgraded
elif position % 7 == 3:
creature = opened_catalog.FourthCreature.FourthNotUpgraded
elif position % 7 == 4:
creature = opened_catalog.FifthCreature.FifthNotUpgraded
elif position % 7 == 5:
creature = opened_catalog.SixthCreature.SixthNotUpgraded
elif position % 7 == 6:
creature = opened_catalog.SeventhCreature.SeventhNotUpgraded
else:
if position % 7 == 0:
creature = opened_catalog.FirstCreature.FirstUpgraded
elif position % 7 == 1:
creature = opened_catalog.SecondCreature.SecondUpgraded
elif position % 7 == 2:
creature = opened_catalog.ThirdCreature.ThirdUpgraded
elif position % 7 == 3:
creature = opened_catalog.FourthCreature.FourthUpgraded
elif position % 7 == 4:
creature = opened_catalog.FifthCreature.FifthUpgraded
elif position % 7 == 5:
creature = opened_catalog.SixthCreature.SixthUpgraded
elif position % 7 == 6:
creature = opened_catalog.SeventhCreature.SeventhUpgraded
font = pygame.font.Font(None, 20)
text_to_print = (str(creature.__doc__).split("\n"))
for number in range(len(text_to_print)):
text = font.render(text_to_print[number], True,
[0, 0, 0])
window.blit(text, [40, 290 + number * 20])
pygame.display.update()
return [(length - 200, width - width // 10, 170, 100)]
pygame.init()
creatures_name = []
buttons_list = create_window()
run = True
array_of_Inferno = ["Imp", "Horned Demon", "Hell Hound", "Succubus",
"Hell Charger", "Pit Fiend", "Devil", "Familiar",
"Horned Overseer", "Cerberus", "Succubus Mistress",
"Nightmare", "Pit Lord", "Arch Devil"]
array_of_Orden = ["Villager", "Archer", "Footman", "Griffin", "Priest",
"Cavalier", "Angel", "Conscript", "Marksman", "Squire",
"Imperial Griffin", "Inquisitor", "Paladin", "Archangel"]
array_of_Necro = ["Skeleton", "Zombie", "Ghost", "Vampire", "Lich",
"Wight", "Bone Dragon", "Skeleton Archer", "Plague Zombie",
"Spectre", "Vampire Lord", "Archlich", "Wraith",
"Spectral Dragon"]
array_of_Forest = ["Pixie", "Blade Dancer", "Hunter", "Druid", "Unicorn",
"Treant", "Green Dragon", "Sprite", "War Dancer",
"Master Hunter", "Druid Elder", "Silver Unicorn",
"Ancien Treant", "Emerald Dragon"]
array_of_Shadows = ["Scout", "Blood Maiden", "Minotaur", "Dark Rider",
"Hydra", "Shadow Witch", "Shadow Dragon", "Assassin",
"Blood Fury", "Minotaur Guard", "Grim Rider", "Deep Hydra",
"Shadow Matriarch", "Black Dragon"]
array_of_Mage = ["Gremlin", "Stone Gargoyle", "Iron Golem", "Mage",
"Djinn", "Rakshasa Rani", "Colossus", "Master Gremlin",
"Obsidian Gargoyle", "Steel Golem", "Archmage",
"Djinn Sultan", "Rakshasa Raja", "Titan"]
opened_catalog = None
page = "Main menu"
i = 0
while run:
i += 1
if i == 120000:
run = False
pygame.time.delay(1)
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
elif page == "Main menu":
if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
pos = pygame.mouse.get_pos()
mouse_x, mouse_y = pos[0], pos[1]
if buttons_list[3][0] < mouse_x < buttons_list[3][0] + \
buttons_list[3][2] and buttons_list[3][1] < mouse_y \
< buttons_list[3][1] + buttons_list[3][3]:
run = False
elif buttons_list[0][0] < mouse_x < buttons_list[0][0] + \
buttons_list[0][2] and buttons_list[0][1] < mouse_y \
< buttons_list[0][1] + buttons_list[0][3]:
i = 0
page = "Start Menu"
buttons_list = start_menu()
elif buttons_list[1][0] < mouse_x < buttons_list[1][0] + \
buttons_list[1][2] and buttons_list[1][1] < mouse_y \
< buttons_list[1][1] + buttons_list[1][3]:
i = 0
page = "Options"
buttons_list = option_menu()
elif buttons_list[2][0] < mouse_x < buttons_list[2][0] + \
buttons_list[2][2] and buttons_list[2][1] < mouse_y \
< buttons_list[2][1] + buttons_list[2][3]:
page = "Information"
buttons_list = information_menu()
i = 0
elif page == "Options":
if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
pos = pygame.mouse.get_pos()
mouse_x, mouse_y = pos[0], pos[1]
if buttons_list[0][0] < mouse_x < buttons_list[0][0] + \
buttons_list[0][2] and buttons_list[0][1] < mouse_y \
< buttons_list[0][1] + buttons_list[0][3]:
i = 0
page = "Main menu"
buttons_list = create_window(800, 600)
elif buttons_list[1][0] < mouse_x < buttons_list[1][0] + \
buttons_list[1][2] and buttons_list[1][1] < mouse_y \
< buttons_list[1][1] + buttons_list[1][3]:
i = 0
page = "Main menu"
buttons_list = create_window(1178, 663)
elif buttons_list[2][0] < mouse_x < buttons_list[2][0] + \
buttons_list[2][2] and buttons_list[2][1] < mouse_y \
< buttons_list[2][1] + buttons_list[2][3]:
i = 0
page = "Main menu"
buttons_list = create_window(1280, 720)
elif buttons_list[3][0] < mouse_x < buttons_list[3][0] + \
buttons_list[3][2] and buttons_list[3][1] < mouse_y \
< buttons_list[3][1] + buttons_list[3][3]:
i = 0
page = "Main menu"
buttons_list = create_window(1920, 1080)
elif buttons_list[4][0] < mouse_x < buttons_list[4][0] + \
buttons_list[4][2] and buttons_list[4][1] < mouse_y \
< buttons_list[4][1] + buttons_list[4][3]:
i = 0
page = "Main menu"
buttons_list = create_window(1600, 800)
elif buttons_list[5][0] < mouse_x < buttons_list[5][0] + \
buttons_list[5][2] and buttons_list[5][1] < mouse_y \
< buttons_list[5][1] + buttons_list[5][3]:
i = 0
page = "Main menu"
fullscreen = not fullscreen
size = [pygame.display.get_surface().get_width(),
pygame.display.get_surface().get_height()]
buttons_list = create_window(size[0], size[1])
elif buttons_list[6][0] < mouse_x < buttons_list[6][0] + \
buttons_list[6][2] and buttons_list[6][1] < mouse_y \
< buttons_list[6][1] + buttons_list[6][3]:
i = 0
page = "Main menu"
size = [pygame.display.get_surface().get_width(),
pygame.display.get_surface().get_height()]
buttons_list = create_window(size[0], size[1])
elif page == "Information":
if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
pos = pygame.mouse.get_pos()
mouse_x, mouse_y = pos[0], pos[1]
if buttons_list[3][0] < mouse_x < buttons_list[3][0] + \
buttons_list[3][2] and buttons_list[3][1] < mouse_y \
< buttons_list[3][1] + buttons_list[3][3]:
i = 0
page = "Main menu"
size = [pygame.display.get_surface().get_width(),
pygame.display.get_surface().get_height()]
buttons_list = create_window(size[0], size[1])
elif buttons_list[0][0] < mouse_x < buttons_list[0][0] + \
buttons_list[0][2] and buttons_list[0][1] < mouse_y \
< buttons_list[0][1] + buttons_list[0][3]:
i = 0
page = "Heroes"
buttons_list = choose_class_display()
elif buttons_list[1][0] < mouse_x < buttons_list[1][0] + \
buttons_list[1][2] and buttons_list[1][1] < mouse_y \
< buttons_list[1][1] + buttons_list[1][3]:
i = 0
page = "Spells"
buttons_list = spell_menu()
elif buttons_list[2][0] < mouse_x < buttons_list[2][0] + \
buttons_list[2][2] and buttons_list[2][1] < mouse_y \
< buttons_list[2][1] + buttons_list[2][3]:
page = "Units"
buttons_list = choose_class_display()
i = 0
elif page == "Start Menu":
if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
pos = pygame.mouse.get_pos()
mouse_x, mouse_y = pos[0], pos[1]
if buttons_list[0][0] < mouse_x < buttons_list[0][0] + \
buttons_list[0][2] and buttons_list[0][1] < mouse_y \
< buttons_list[0][1] + buttons_list[0][3]:
i = 0
page = "Main menu"
size = [pygame.display.get_surface().get_width(),
pygame.display.get_surface().get_height()]
buttons_list = create_window(size[0], size[1])
elif page == "Units":
if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
pos = pygame.mouse.get_pos()
mouse_x, mouse_y = pos[0], pos[1]
if buttons_list[0][0] < mouse_x < buttons_list[0][0] + \
buttons_list[0][2] and buttons_list[0][1] < mouse_y \
< buttons_list[0][1] + buttons_list[0][3]:
i = 0
page = "Orden Units"
opened_catalog = Orden
buttons_list, creatures_name = show_units("Orden")
elif buttons_list[1][0] < mouse_x < buttons_list[1][0] + \
buttons_list[1][2] and buttons_list[1][1] < mouse_y \
< buttons_list[1][1] + buttons_list[1][3]:
i = 0
page = "Necropolis Units"
opened_catalog = Necro
buttons_list, creatures_name = show_units("Necropolis")
elif buttons_list[2][0] < mouse_x < buttons_list[2][0] + \
buttons_list[2][2] and buttons_list[2][1] < mouse_y \
< buttons_list[2][1] + buttons_list[2][3]:
i = 0
page = "Inferno Units"
opened_catalog = Inferno
buttons_list, creatures_name = show_units("Inferno")
elif buttons_list[3][0] < mouse_x < buttons_list[3][0] + \
buttons_list[3][2] and buttons_list[3][1] < mouse_y \
< buttons_list[3][1] + buttons_list[3][3]:
page = "Nature Protection Units"
buttons_list, creatures_name = show_units(
"Nature Protection")
opened_catalog = NatureProtection
i = 0
elif buttons_list[4][0] < mouse_x < buttons_list[4][0] + \
buttons_list[4][2] and buttons_list[4][1] < mouse_y \
< buttons_list[4][1] + buttons_list[4][3]:
page = "Shadow League Units"
opened_catalog = ShadowLeague
buttons_list, creatures_name = show_units("Shadow League")
i = 0
elif buttons_list[5][0] < mouse_x < buttons_list[5][0] + \
buttons_list[5][2] and buttons_list[5][1] < mouse_y \
< buttons_list[5][1] + buttons_list[5][3]:
page = "Mage Units"
opened_catalog = Mage
buttons_list, creatures_name = show_units("Mage")
i = 0
elif buttons_list[6][0] < mouse_x < buttons_list[6][0] + \
buttons_list[6][2] and buttons_list[6][1] < mouse_y \
< buttons_list[6][1] + buttons_list[6][3]:
page = "Information"
buttons_list = information_menu()
i = 0
elif page == "Heroes":
if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
pos = pygame.mouse.get_pos()
mouse_x, mouse_y = pos[0], pos[1]
if buttons_list[0][0] < mouse_x < buttons_list[0][0] + \
buttons_list[0][2] and buttons_list[0][1] < mouse_y \
< buttons_list[0][1] + buttons_list[0][3]:
i = 0
page = "Orden Heroes"
buttons_list = show_heroes("Orden")
elif buttons_list[1][0] < mouse_x < buttons_list[1][0] + \
buttons_list[1][2] and buttons_list[1][1] < mouse_y \
< buttons_list[1][1] + buttons_list[1][3]:
i = 0
page = "Necropolis Heroes"
buttons_list = show_heroes("Necropolis")
elif buttons_list[2][0] < mouse_x < buttons_list[2][0] + \
buttons_list[2][2] and buttons_list[2][1] < mouse_y \
< buttons_list[2][1] + buttons_list[2][3]:
i = 0
page = "Inferno Heroes"
buttons_list = show_heroes("Inferno")
elif buttons_list[3][0] < mouse_x < buttons_list[3][0] + \
buttons_list[3][2] and buttons_list[3][1] < mouse_y \
< buttons_list[3][1] + buttons_list[3][3]:
page = "Nature Protection Heroes"
buttons_list = show_heroes("Nature Protection")
i = 0
elif buttons_list[4][0] < mouse_x < buttons_list[4][0] + \
buttons_list[4][2] and buttons_list[4][1] < mouse_y \
< buttons_list[4][1] + buttons_list[4][3]:
page = "Shadow League Heroes"
buttons_list = show_heroes("Shadow League")
i = 0
elif buttons_list[5][0] < mouse_x < buttons_list[5][0] + \
buttons_list[5][2] and buttons_list[5][1] < mouse_y \
< buttons_list[5][1] + buttons_list[5][3]:
page = "Mage Heroes"
buttons_list = show_heroes("Mage")
i = 0
elif buttons_list[6][0] < mouse_x < buttons_list[6][0] + \
buttons_list[6][2] and buttons_list[6][1] < mouse_y \
< buttons_list[6][1] + buttons_list[6][3]:
page = "Information"
buttons_list = information_menu()
i = 0
elif page == "Spells":
if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
pos = pygame.mouse.get_pos()
mouse_x, mouse_y = pos[0], pos[1]
if buttons_list[0][0] < mouse_x < buttons_list[0][0] + \
buttons_list[0][2] and buttons_list[0][1] < mouse_y \
< buttons_list[0][1] + buttons_list[0][3]:
i = 0
page = "Dark"
size = [pygame.display.get_surface().get_width(),
pygame.display.get_surface().get_height()]
buttons_list = create_window(size[0], size[1])
elif buttons_list[1][0] < mouse_x < buttons_list[1][0] + \
buttons_list[1][2] and buttons_list[1][1] < mouse_y \
< buttons_list[1][1] + buttons_list[1][3]:
i = 0
page = "Destructive"
buttons_list = choose_class_display()
elif buttons_list[2][0] < mouse_x < buttons_list[2][0] + \
buttons_list[2][2] and buttons_list[2][1] < mouse_y \
< buttons_list[2][1] + buttons_list[2][3]:
i = 0
page = "Light"
buttons_list = spell_menu()
elif buttons_list[3][0] < mouse_x < buttons_list[3][0] + \
buttons_list[3][2] and buttons_list[3][1] < mouse_y \
< buttons_list[3][1] + buttons_list[3][3]:
page = "Summoning"
buttons_list = choose_class_display()
i = 0
elif buttons_list[4][0] < mouse_x < buttons_list[4][0] + \
buttons_list[4][2] and buttons_list[4][1] < mouse_y \
< buttons_list[4][1] + buttons_list[4][3]:
page = "Information"
buttons_list = information_menu()
i = 0
elif page == "Orden Units":
if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
pos = pygame.mouse.get_pos()
mouse_x, mouse_y = pos[0], pos[1]
if buttons_list[14][0] < mouse_x < buttons_list[14][0] + \
buttons_list[14][2] and buttons_list[14][1] < mouse_y \
< buttons_list[14][1] + buttons_list[14][3]:
i = 0
page = "Units"
buttons_list = choose_class_display()
else:
for index in range(14):
if buttons_list[index][0] < mouse_x < buttons_list[
index][0] + buttons_list[index][2] and \
buttons_list[index][1] < mouse_y < \
buttons_list[index][1] + buttons_list[index][
3]:
i = 0
page = creatures_name[index]
buttons_list = show_unit(creatures_name[index])
break
elif page == "Necropolis Units":
if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
pos = pygame.mouse.get_pos()
mouse_x, mouse_y = pos[0], pos[1]
if buttons_list[14][0] < mouse_x < buttons_list[14][0] + \
buttons_list[14][2] and buttons_list[14][1] < mouse_y \
< buttons_list[14][1] + buttons_list[14][3]:
i = 0
page = "Units"
buttons_list = choose_class_display()
else:
for index in range(14):
if buttons_list[index][0] < mouse_x < buttons_list[
index][0] + buttons_list[index][2] and \
buttons_list[index][1] < mouse_y < \
buttons_list[index][1] + buttons_list[index][
3]:
i = 0
page = creatures_name[index]
buttons_list = show_unit(creatures_name[index])
break
elif page == "Nature Protection Units":
if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
pos = pygame.mouse.get_pos()
mouse_x, mouse_y = pos[0], pos[1]
if buttons_list[14][0] < mouse_x < buttons_list[14][0] + \
buttons_list[14][2] and buttons_list[14][1] < mouse_y \
< buttons_list[14][1] + buttons_list[14][3]:
i = 0
page = "Units"
buttons_list = choose_class_display()
else:
for index in range(14):
if buttons_list[index][0] < mouse_x < buttons_list[
index][0] + buttons_list[index][2] and \
buttons_list[index][1] < mouse_y < \
buttons_list[index][1] + buttons_list[index][
3]:
i = 0
page = creatures_name[index]
buttons_list = show_unit(creatures_name[index])
break
elif page == "Shadow League Units":
if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
pos = pygame.mouse.get_pos()
mouse_x, mouse_y = pos[0], pos[1]
if buttons_list[14][0] < mouse_x < buttons_list[14][0] + \
buttons_list[14][2] and buttons_list[14][1] < mouse_y \
< buttons_list[14][1] + buttons_list[14][3]:
i = 0
page = "Units"
buttons_list = choose_class_display()
else:
for index in range(14):
if buttons_list[index][0] < mouse_x < buttons_list[
index][0] + buttons_list[index][2] and \
buttons_list[index][1] < mouse_y < \
buttons_list[index][1] + buttons_list[index][
3]:
i = 0
page = creatures_name[index]
buttons_list = show_unit(creatures_name[index])
break
elif page == "Inferno Units":
if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
pos = pygame.mouse.get_pos()
mouse_x, mouse_y = pos[0], pos[1]
if buttons_list[14][0] < mouse_x < buttons_list[14][0] + \
buttons_list[14][2] and buttons_list[14][1] < mouse_y \
< buttons_list[14][1] + buttons_list[14][3]:
i = 0
page = "Units"
buttons_list = choose_class_display()
else:
for index in range(14):
if buttons_list[index][0] < mouse_x < buttons_list[
index][0] + buttons_list[index][2] and \
buttons_list[index][1] < mouse_y < \
buttons_list[index][1] + buttons_list[
index][3]:
i = 0
page = creatures_name[index]
buttons_list = show_unit(creatures_name[index])
break
elif page == "Mage Units":
if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
pos = pygame.mouse.get_pos()
mouse_x, mouse_y = pos[0], pos[1]
if buttons_list[14][0] < mouse_x < buttons_list[14][0] + \
buttons_list[14][2] and buttons_list[14][1] < mouse_y \
< buttons_list[14][1] + buttons_list[14][3]:
i = 0
page = "Units"
buttons_list = choose_class_display()
else:
for index in range(14):
if buttons_list[index][0] < mouse_x < buttons_list[
index][0] + buttons_list[index][2] and \
buttons_list[index][1] < mouse_y < \
buttons_list[index][1] + buttons_list[index][
3]:
i = 0
page = creatures_name[index]
buttons_list = show_unit(creatures_name[index])
break
elif page == "Orden Heroes":
if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
pos = pygame.mouse.get_pos()