-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecranInterNiveau.py
61 lines (50 loc) · 2.04 KB
/
ecranInterNiveau.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
def ecranInterNiveau(windows, time, nbNiveau):
import pygame
pygame.init()
pygame.mixer.init()
from main import niveau1
from Platformer import niveau2
background = pygame.image.load('sprite/spriteMenu/backgroundmenu.png')
background = pygame.transform.scale(background, (1024, 768))
#choix niveau
retour = pygame.image.load('sprite/spriteMenu/retour.png')
retour = pygame.transform.scale(retour, (326, 71))
titreVictoire = pygame.image.load('sprite/spriteMenu/victoire.png')
selection = pygame.image.load('sprite/spriteMenu/selection.png')
selection = pygame.transform.scale(selection, (41, 71))
selector = 1
placement = 280
font = pygame.font.SysFont("comicsans", 60, True)
temps = font.render("Temps : " + str(time/1000) + " s", 1, (0, 0, 0))
def getHighScore():
f = open('highScore/highScore' + nbNiveau + '.txt', 'r')
data = f.read()
f.close()
data = data.split('\n')
highScore = int(data[0])
for score in data:
if int(score) < highScore:
highScore = int(score)
return highScore
meilleurTemps = font.render("HighScore : " + str(int(getHighScore()) / 1000) + " s", 1, (0, 0, 0))
def drawecranInterNiveau():
windows.blit(background, (0, 0))
windows.blit(titreVictoire, (349, 80))
windows.blit(retour,(349, 580))
windows.blit(temps, (349, 280))
windows.blit(meilleurTemps, (349, 380))
placement = 580
windows.blit(selection, (300,placement))
pygame.display.update()
runChoix = True
while runChoix:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.mixer.music.stop()
runChoix = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_RETURN or event.key == pygame.K_SPACE:
if selector == 1:
pygame.mixer.music.stop()
runChoix = False
drawecranInterNiveau()