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
|
#import et initialisation
import pygame
from pygame.locals import *
import time
pygame.init()
pygame.font.init()
#fenetre
pygame.display.set_caption("The Lost by KJ")
fenetre = pygame.display.set_mode((854, 443))
#initialisation des variables
score = 0
continuer = 1
#def
#choix porte 1
def choix():
score += 1
s=str(score)
#Cal_Score(score)
Af_score(s)
porte2()
#affichage score
def Af_score(s):
myfont = pygame.font.SysFont("monospace", 25)
score_display = myfont.render(s, 1, (0,0,0))
fenetre.blit(score_display, (10, 35))
#transforme score int en str
def Cal_Score(score):
score = str(score)
return score
#affichage porte
def porte():
porte = pygame.image.load("porte.png").convert()
fenetre.blit(porte, (0,0))
return porte
#affichage port2 "ratturer" pour test
def porte2():
porte2 = pygame.image.load("porte2.png").convert()
fenetre.blit(porte2, (0,0))
return porte2
#image menu
menu = pygame.image.load("menu.png").convert()
fenetre.blit(menu, (0,0))
#rafraichir ecran
pygame.display.flip()
#main
while continuer:
for event in pygame.event.get():
if event.type == QUIT:
continuer = 0
if event.type == MOUSEBUTTONDOWN and event.button == 1 and ((event.pos[0] > 120) and( event.pos[1] > 220)) and ((event.pos[0] < 250) and (event.pos[1] < 270)):
porte()
if event.type == MOUSEBUTTONDOWN and event.button == 1 and (((event.pos[0] > 80) and( event.pos[1] > 70)) and ((event.pos[0] < 220) and (event.pos[1] < 385))) or (((event.pos[0] > 370) and( event.pos[1] > 70)) and ((event.pos[0] < 500) and (event.pos[1] < 390))) or (((event.pos[0] > 665) and( event.pos[1] > 80)) and ((event.pos[0] < 800) and (event.pos[1] < 390))):
choix()
if event.type == MOUSEBUTTONDOWN and event.button == 1 and ((event.pos[0] > 580) and( event.pos[1] > 230)) and ((event.pos[0] < 690) and (event.pos[1] < 280)):
continuer = 0
pygame.display.flip() |
Partager