-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.py
66 lines (51 loc) · 1.8 KB
/
script.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
from classes import *
pygame.init()
pygame.font.init()
FPSCLOCK=pygame.time.Clock()
menu = redimension(load(menu), fenX,fenY)
fond = redimension(load(fond), fenX,fenY)
mur = redimension(load(mur), cote_case,cote_case)
depart = redimension(load(depart), cote_case,cote_case)
arrivee = redimension(load(arrivee), cote_case,cote_case)
fen = pygame.display.set_mode((fenX, fenY))
pygame.display.set_caption(titre)
qui = 0
skins = set_skins(qui)
pygame.key.set_repeat(75, 75)
maze = maze()
perso = perso(skins)
i_menu = True
while True:
if i_menu:
fen.blit(menu, (0,0))
fen.blit(redimension(perso.skin, cote_case*2,cote_case*2), (fenX/2-cote_case,fenY/2-cote_case))
else:
fen.blit(fond, (0,0))
for y,ligne in enumerate(maze.maze):
for x,case in enumerate(ligne):
if case == '#':
fen.blit(mur, (x*cote_case,y*cote_case))
fen.blit(depart, (0,0))
fen.blit(arrivee, (fenX-cote_case,fenY-cote_case))
fen.blit(perso.skin, (perso.x*cote_case,perso.y*cote_case))
for event in pygame.event.get():
test_fin(event)
if test_touche(event,K_SPACE):
perso.make(skins)
maze.make()
i_menu = False
if test_touche(event,K_ESCAPE):
perso.make(skins)
if event.type == KEYDOWN:
if i_menu:
if test_touche(event,K_RIGHT):
qui +=1
elif test_touche(event,K_LEFT):
qui -=1
skins = set_skins(qui)
perso.make(skins)
else:
perso.move(event.key,maze.maze)
if perso.x == largeur*2-2 and perso.y == hauteur*2-2:
i_menu = True
pygame.display.flip()