-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathHud.py
More file actions
65 lines (54 loc) · 2.26 KB
/
Hud.py
File metadata and controls
65 lines (54 loc) · 2.26 KB
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
from pygame import QUIT, KEYDOWN, K_r, K_x
import time
from Start import *
class Hud:
def inicio(self):
startGame = Start()
fonte2 = pygame.font.SysFont('arial', 40, True, True)
mensagem = f"BEM VINDO! PRESSIONE X PARA INICIAR"
texto_formatado = fonte2.render(mensagem, True, (255, 255, 255))
ret_texto = texto_formatado.get_rect()
startGame.tela.blit(startGame.image, (0, 0))
startGame.tela.blit(startGame.calegario, (0, 200))
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
quit()
if event.type == KEYDOWN:
if event.key == K_x:
return False
ret_texto.center = (512, 360)
startGame.tela.blit(texto_formatado, ret_texto)
pygame.display.update()
def start(self):
startGame = Start()
fonte2 = pygame.font.SysFont('arial', 25, True, True)
mensagem = f"Bateu!! Pressione a tecla R para continuar"
texto_formatado = fonte2.render(mensagem, True, (255, 255, 255))
ret_texto = texto_formatado.get_rect()
startGame.tela.blit(startGame.image, (0, 0))
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
quit()
if event.type == KEYDOWN:
if event.key == K_r:
return True
ret_texto.center = (512, 360)
startGame.tela.blit(texto_formatado, ret_texto)
pygame.display.update()
def gameOver(self, pontos):
startGame = Start()
fonte3 = pygame.font.SysFont('arial', 25, True, True)
mensagem = f"VOCÊ PONTUOU {pontos}, PARABÉNS"
fonte3 = pygame.font.SysFont('arial', 40, True, True)
mensagem = f"VOCÊ PONTUOU {pontos} PONTOS, PARABÉNS!"
texto_formatado = fonte3.render(mensagem, True, (255, 255, 255))
ret_texto = texto_formatado.get_rect()
ret_texto.center = (512, 360)
startGame.tela.blit(startGame.image, (0, 0))
startGame.tela.blit(texto_formatado, ret_texto)
pygame.display.update()
time.sleep(10)