-
Notifications
You must be signed in to change notification settings - Fork 0
/
CharacterSelect.py
138 lines (130 loc) · 5.28 KB
/
CharacterSelect.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
import pygame
from pygame.locals import *
import GameMech
import LevelSelect
pygame.init()
screen = pygame.display.set_mode([1200,700])
font=pygame.font.SysFont("Courier New", 46)
font2=pygame.font.SysFont("Courier New", 32)
screen.fill([250,250,250])
def characterselect():
p1option=""
p2option=""
p1x=-100
p2x=-100
p1y=-100
p2y=-100
background=pygame.image.load("CharacterSelect.png")
background=pygame.transform.scale(background, (1200,700))
backgroundrec=background.get_rect()
p1rect=pygame.image.load("p1rect.png")
p2rect=pygame.image.load("p2rect.png")
screen.blit(background,backgroundrec)
EndGame=0
enteredGame = False
option = 0
#defaults
p1option = "FinalSpritev2RedCap.png"
p2option = "FinalSpritev2RedCap.png"
while EndGame!=1:
screen.blit(background,backgroundrec)
screen.blit(p1rect,(p1x,p1y))
screen.blit(p2rect,(p2x,p2y))
pygame.display.update()
for event in pygame.event.get():
if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE):
return
if event.type==MOUSEBUTTONDOWN:
EndGame=2
if EndGame==2:
location=pygame.mouse.get_pos()
if location[0]>30 and location [0]<92 and location[1]>60 and location[1]<176:
p1x=30
p1y=60
p1option="FinalSpritev2RedCap.png"
EndGame=0
screen.blit(background,backgroundrec)
elif location[0]>209 and location[0]<278 and location[1]>60 and location[1]<176:
p1x=209
p1y=60
p1option="FinalSpritev2NoHair.png"
EndGame=0
screen.blit(background,backgroundrec)
elif location[0]>392 and location[0]<468 and location[1]>60 and location[1]<176:
p1x=392
p1y=60
p1option="FinalSpritev2GreenMohawk.png"
EndGame=0
screen.blit(background,backgroundrec)
elif location[0]>606 and location[0]<672 and location[1]>60 and location[1]<176:
p1x=606
p1y=60
p1option="FinalSpritev2BlueCap.png"
EndGame=0
screen.blit(background,backgroundrec)
elif location[0]>830 and location[0]<900 and location[1]>60 and location[1]<176:
p1x=830
p1y=60
p1option="FinalSpritev2Blonde.png"
EndGame=0
screen.blit(background,backgroundrec)
elif location[0]>1070 and location[0]<1142 and location[1]>60 and location[1]<176:
p1x=1070
p1y=60
p1option="FinalSpritev2Basket.png"
EndGame=0
screen.blit(background,backgroundrec)
elif location[0]>32 and location[0]<100 and location[1]>383 and location[1]<546:
p2x=32
p2y=383
p2option="FinalSpritev2RedCap.png"
EndGame=0
screen.blit(background,backgroundrec)
elif location[0]>201 and location[0]<262 and location[1]>396 and location[1]<546:
p2x=201
p2y=396
p2option="FinalSpritev2NoHair.png"
EndGame=0
screen.blit(background,backgroundrec)
elif location[0]>399 and location[0]<462 and location[1]>390 and location[1]<546:
p2x=399
p2y=390
p2option="FinalSpritev2GreenMohawk.png"
EndGame=0
screen.blit(background,backgroundrec)
elif location[0]>607 and location[0]<684 and location[1]>398 and location[1]<546:
p2x=607
p2y=398
p2option="FinalSpritev2BlueCap.png"
EndGame=0
screen.blit(background,backgroundrec)
elif location[0]>842 and location[0]<900 and location[1]>398 and location[1]<546:
p2x=842
p2y=398
p2option="FinalSpritev2Blonde.png"
EndGame=0
screen.blit(background,backgroundrec)
elif location[0]>1081 and location[0]<1142 and location[1]>396 and location[1]<546:
p2x=1081
p2y=396
p2option="FinalSpritev2Basket.png"
EndGame=0
screen.blit(background,backgroundrec)
elif location[0]>900 and location[0]<1140 and location[1]>590 and location[1]<690:
charFile=open("characters.txt","wb")
charFile.write(p1option)
charFile.write("\n")
charFile.write(p2option)
charFile.close()
p1x=-100
p1y=-100
p2x=-100
p2y=-100
EndGame = 0
option = LevelSelect.selectLevel()
if option <=0:
return
elif location[0]>50 and location[0]<260 and location[1]>590 and location[1]<690:
return
else:
EndGame = 0