-
Notifications
You must be signed in to change notification settings - Fork 1
/
jogar_novamente.py
97 lines (78 loc) · 3.25 KB
/
jogar_novamente.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
#importando coisas
import pygame
from os import path
from sympy import fps
from Candidatos import Candidatos
from configuracoes import *
import time
from Classes import Button
import os
pygame.mixer.init()
def jogar_novamente_screen(screen,condicao,WIDTH, HEIGHT):
#unidade de tempo
clock=pygame.time.Clock()
saida = ENCERRAR
#carrega botões
sair_img = pygame.image.load(path.join(IMG_DIR,'Sair.png')).convert_alpha()
jogarnv_img = pygame.image.load(path.join(IMG_DIR,'Jogar_novamente.png')).convert_alpha()
sair_button = Button(100,200,sair_img,0.5)
jogarnv_button = Button(100,300,jogarnv_img,0.5)
Derrota=pygame.image.load(path.join(IMG_DIR, 'GameOver.png')).convert()
Derrota_small = pygame.transform.scale(Derrota, (WIDTH, HEIGHT))
Vitoria=pygame.image.load(path.join(IMG_DIR, 'Vitoria.png')).convert()
Vitoria_small = pygame.transform.scale(Vitoria, (WIDTH, HEIGHT))
rodando = True
tempo=0
while rodando:
clock.tick(60)
screen.fill((0,0,0))
#carregar o fundo da tela de menu
if condicao==VITORIA:
Vitoria=pygame.image.load(path.join(IMG_DIR, 'Vitoria.png')).convert()
Vitoria_small = pygame.transform.scale(Vitoria, (WIDTH, HEIGHT))
#primeira tela final
screen.fill((0,0,0))
screen.blit(Vitoria_small,(0,0))
pygame.display.update()
for event in pygame.event.get():
if event.type == pygame.QUIT:
rodando=False
if event.type == pygame.KEYUP:
if event.key == pygame.K_s:
rodando= False
if event.key == pygame.K_RETURN:
saida = MENU
rodando = False
elif condicao==EMPATE:
Derrota=pygame.image.load(path.join(IMG_DIR, 'GameOver.png')).convert()
Derrota_small = pygame.transform.scale(Derrota, (WIDTH, HEIGHT))
for event in pygame.event.get():
if event.type == pygame.QUIT:
rodando=False
if event.type == pygame.KEYUP:
if event.key == pygame.K_s:
rodando= False
if event.key == pygame.K_RETURN:
saida = MENU
rodando = False
#segunda tela final
screen.fill((0,0,0))
screen.blit(Derrota_small,(0,0))
pygame.display.update()
else:
Derrota=pygame.image.load(path.join(IMG_DIR, 'GameOver.png')).convert()
Derrota_small = pygame.transform.scale(Derrota, (WIDTH, HEIGHT))
for event in pygame.event.get():
if event.type == pygame.QUIT:
rodando=False
if event.type == pygame.KEYUP:
if event.key == pygame.K_s:
rodando= False
if event.key == pygame.K_RETURN:
saida = MENU
rodando = False
#terceira tela de final
screen.fill((0,0,0))
screen.blit(Derrota_small,(0,0))
pygame.display.update()
return saida