-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcena_principal.py
410 lines (353 loc) · 25.3 KB
/
cena_principal.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
import sys
import time
from typing import Tuple
from alienigena import Alienigena
from bomba import Bomba
from mapa import Mapa, TileType
from personagem import Personagem
import pygame
from cronometro import Cronometro
from config_jogo import ConfigJogo
from projetil import Projetil
from utils import ler_imagem
from quartel import Quartel
import numpy as np
class CenaPrincipal():
def __init__(self, tela: pygame.display, num_jogadores: int, bombas: list[list[Bomba], list[Bomba]], projeteis: list[Projetil]):
self.mapa = Mapa()
self.tela = tela
self.encerrada = False
self.inimigos = []
self.quartel = Quartel(self.mapa, self.tela)
self.cronometro = Cronometro()
self.bombas = bombas
self.projeteis = projeteis
self.derrota = True
self._time_last_spawn = 0
self.img_relogio = ler_imagem('telas/relogio.png', (ConfigJogo.TAM_TILE, ConfigJogo.TAM_TILE))
if num_jogadores == 1:
self.p1 = Personagem(self.mapa, ConfigJogo.TAM_TILE, ConfigJogo.TAM_TILE + ConfigJogo.ALTURA_MENU, self.tela, self.quartel)
self.p2: Personagem = False
else:
self.p1 = Personagem(self.mapa, ConfigJogo.TAM_TILE, ConfigJogo.TAM_TILE + ConfigJogo.ALTURA_MENU, self.tela, self.quartel)
self.p2 = Personagem(self.mapa, (ConfigJogo.LARGURA_TELA - 2*ConfigJogo.TAM_TILE), (ConfigJogo.ALTURA_TELA - 2*ConfigJogo.TAM_TILE), self.tela, self.quartel)
while(self.p1.pIdx == self.p2.pIdx):
self.p2 = Personagem(self.mapa, (ConfigJogo.LARGURA_TELA - 2*ConfigJogo.TAM_TILE), (ConfigJogo.ALTURA_TELA - 2*ConfigJogo.TAM_TILE), self.tela, self.quartel)
def verifica_aura(self, personagem: Personagem):
self.quartel.fantasmas = [fantasma for fantasma in self.quartel.fantasmas if not fantasma.morto]
if self.quartel.fantasmas:
posicoes_fantasmas = np.array([
(float(inimigo.getX()), float(inimigo.getY()), inimigo.get_tipo_aura())
for inimigo in self.quartel.fantasmas
])
posicoes_fantasmas = np.atleast_2d(posicoes_fantasmas)
distancias = np.sqrt((personagem.getX() - posicoes_fantasmas[:, 0])**2 + (personagem.getY() - posicoes_fantasmas[:, 1])**2)
idx_fantasma_perto = np.argmin(distancias)
if distancias[idx_fantasma_perto] <= ConfigJogo.RAIO_AURA:
aura_fantasma_perto = posicoes_fantasmas[idx_fantasma_perto, 2]
if not personagem.cd_atualizado or personagem.tipo_fantasma_perto != aura_fantasma_perto:
self.atualiza_cd(personagem, aura_fantasma_perto)
else:
personagem.cd_atualizado = False
personagem.cd = ConfigJogo.CD_PERSONAGEM
personagem.duracao_bomba = ConfigJogo.DURACAO_BOMBA
def atualiza_cd(self, personagem: Personagem, aura_fantasma_perto: int):
if aura_fantasma_perto == 0:
personagem.cd = ConfigJogo.CD_AURA_RAPIDA
personagem.duracao_bomba = ConfigJogo.DURACAO_BOMBA_RAPIDA
elif aura_fantasma_perto == 1:
personagem.cd = ConfigJogo.CD_AURA_LENTA
personagem.duracao_bomba = ConfigJogo.DURACAO_BOMBA_LENTA
personagem.cd_atualizado = True
personagem.tipo_fantasma_perto = aura_fantasma_perto
def rodar(self):
while not self.encerrada:
self.mapa.desenha(self.tela)
for bomba in self.p1.bombas:
bomba.desenha(self.tela, self.mapa, self.bombas, self.p1.colisao, self.p1.colisao)
if self.p2:
for bomba in self.p2.bombas:
bomba.desenha(self.tela, self.mapa, self.bombas, self.p1.colisao, self.p2.colisao)
self.p1.desenha()
if self.p2:
self.p2.desenha()
self.quartel.desenha(self.bombas)
self.quartel.tratamento_eventos(self.bombas)
self.tratamento_eventos()
self.desenha_menu()
pygame.display.flip()
def tratamento_eventos(self):
if self.quartel.getVida() == 0:
self.derrota = False
self.encerrada = True
if not self.p2:
if self.p1.morto or self.cronometro.tempo_passado() > ConfigJogo.DURACAO_JOGO:
self.encerrada = True
return
elif self.p1.morto and self.p2.morto or self.quartel.getVida() == 0 or self.cronometro.tempo_passado() > ConfigJogo.DURACAO_JOGO:
self.encerrada = True
return
self.inimigos = self.quartel.getInimigos()
tempo = time.time()
# evento de saida
if pygame.key.get_pressed()[pygame.K_ESCAPE]:
sys.exit(0)
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_SPACE:
self.p1.soltar_bomba(self.bombas, 1)
if event.key == pygame.K_0 and self.p2:
self.p2.soltar_bomba(self.bombas, 2)
if self.p1:
if self.p1.morto:
self.p1.setX(-100)
self.p1.setY(-100)
else:
self.verifica_aura(self.p1)
if tempo - self.p1._time_last_move > self.p1.cd:
if tempo - self.p1.time_inalvejavel < 5:
if ((tempo - self.p1.time_inalvejavel) % 0.5) < 0.25:
self.p1.personagem.set_alpha(100)
else:
self.p1.personagem.set_alpha(190)
else:
self.p1.personagem.set_alpha(255)
new_p1x = self.p1.getX()
new_p1y = self.p1.getY()
if pygame.key.get_pressed()[pygame.K_a]:
if (self.p1.getY()%ConfigJogo.TAM_TILE)<15 and (self.p1.getY()%ConfigJogo.TAM_TILE)!=0 and self.p1.getMapa().destrutivel(self.p1.getX()-1, self.p1.getY()+int(ConfigJogo.TAM_TILE/2))==TileType.GRAMA.value:
new_p1y = self.p1.getY() - ConfigJogo.VELOCIDADE_PERSONAGEM
elif (self.p1.getY()%ConfigJogo.TAM_TILE)>17 and self.p1.getMapa().destrutivel(self.p1.getX()-1, self.p1.getY()+int(ConfigJogo.TAM_TILE/2))==TileType.GRAMA.value:
new_p1y = self.p1.getY() + ConfigJogo.VELOCIDADE_PERSONAGEM
else:
new_p1x = self.p1.getX() - ConfigJogo.VELOCIDADE_PERSONAGEM
if self.quartel.quartel_colisao(new_p1x, new_p1y):
self.p1.colisao_quartel = True
else:
self.p1.colisao_quartel = False
if pygame.key.get_pressed()[pygame.K_d]:
if (self.p1.getY()%ConfigJogo.TAM_TILE)<15 and (self.p1.getY()%ConfigJogo.TAM_TILE)!=0 and self.p1.getMapa().destrutivel(self.p1.getX()+ConfigJogo.TAM_TILE+1, self.p1.getY()+int(ConfigJogo.TAM_TILE/2))==TileType.GRAMA.value:
new_p1y = self.p1.getY() - ConfigJogo.VELOCIDADE_PERSONAGEM
elif (self.p1.getY()%ConfigJogo.TAM_TILE)>17 and self.p1.getMapa().destrutivel(self.p1.getX()+ConfigJogo.TAM_TILE+1, self.p1.getY()+int(ConfigJogo.TAM_TILE/2))==TileType.GRAMA.value:
new_p1y = self.p1.getY() + ConfigJogo.VELOCIDADE_PERSONAGEM
else:
new_p1x = self.p1.getX() + ConfigJogo.VELOCIDADE_PERSONAGEM
if self.quartel.quartel_colisao(new_p1x + ConfigJogo.TAM_TILE, new_p1y):
self.p1.colisao_quartel = True
else:
self.p1.colisao_quartel = False
if pygame.key.get_pressed()[pygame.K_s]:
if (self.p1.getX()%ConfigJogo.TAM_TILE)<15 and (self.p1.getX()%ConfigJogo.TAM_TILE)!=0 and self.p1.getMapa().destrutivel(self.p1.getX()+int(ConfigJogo.TAM_TILE/2), self.p1.getY()+ConfigJogo.TAM_TILE+1)==TileType.GRAMA.value:
new_p1x = self.p1.getX() - ConfigJogo.VELOCIDADE_PERSONAGEM
elif (self.p1.getX()%ConfigJogo.TAM_TILE)>17 and self.p1.getMapa().destrutivel(self.p1.getX()+int(ConfigJogo.TAM_TILE/2), self.p1.getY()+ConfigJogo.TAM_TILE+1)==TileType.GRAMA.value:
new_p1x = self.p1.getX() + ConfigJogo.VELOCIDADE_PERSONAGEM
else:
new_p1y = self.p1.getY() + ConfigJogo.VELOCIDADE_PERSONAGEM
if self.quartel.quartel_colisao(new_p1x, new_p1y + ConfigJogo.TAM_TILE):
self.p1.colisao_quartel = True
else:
self.p1.colisao_quartel = False
if pygame.key.get_pressed()[pygame.K_w]:
if (self.p1.getX()%ConfigJogo.TAM_TILE)<15 and (self.p1.getX()%ConfigJogo.TAM_TILE)!=0 and self.p1.getMapa().destrutivel(self.p1.getX()+int(ConfigJogo.TAM_TILE/2), self.p1.getY()-1)==TileType.GRAMA.value:
new_p1x = self.p1.getX() - ConfigJogo.VELOCIDADE_PERSONAGEM
elif (self.p1.getX()%ConfigJogo.TAM_TILE)>17 and self.p1.getMapa().destrutivel(self.p1.getX()+int(ConfigJogo.TAM_TILE/2), self.p1.getY()-1)==TileType.GRAMA.value:
new_p1x = self.p1.getX() + ConfigJogo.VELOCIDADE_PERSONAGEM
else:
new_p1y = self.p1.getY() - ConfigJogo.VELOCIDADE_PERSONAGEM
if self.quartel.quartel_colisao(new_p1x, new_p1y):
self.p1.colisao_quartel = True
else:
self.p1.colisao_quartel = False
#COLISAO COM PERSONAGEM E PROJETIL OU PERSONAGEM E INIMIGO
for inimigo in self.inimigos:
if self.p1.colisao.colliderect(inimigo.colisao):
if time.time() - self.p1.time_inalvejavel > 5:
self.p1.set_vida(self.p1.get_vida() - 1)
if self.p1.get_vida() == 0:
self.p1.morto = True
return
else:
new_p1x = ConfigJogo.TAM_TILE
new_p1y = ConfigJogo.TAM_TILE + ConfigJogo.ALTURA_MENU
self.p1.time_inalvejavel=time.time()
if type(inimigo) == Alienigena:
for projetil in inimigo.projeteis:
if self.p1.colisao.colliderect(projetil.colisao):
projetil.colidido = True
inimigo.projeteis.remove(projetil)
if time.time() - self.p1.time_inalvejavel > 5:
self.p1.set_vida(self.p1.get_vida() - 1)
if self.p1.get_vida() == 0:
self.p1.morto = True
return
else:
new_p1x = ConfigJogo.TAM_TILE
new_p1y = ConfigJogo.TAM_TILE + ConfigJogo.ALTURA_MENU
self.p1.time_inalvejavel=time.time()
if not self.p1.getMapa().is_any_wall(new_p1x, new_p1y) and not self.p1.colisao_quartel:
bombaColisao = False
for bombaVetor in self.bombas:
for bomba in bombaVetor:
if not bomba.explosao and not self.p1.colisao.colliderect(bomba.colisao): #Para não colidir após colocar a bomba
bomba_tile = (bomba.getX() // ConfigJogo.TAM_TILE, bomba.getY() // ConfigJogo.TAM_TILE)
new_p1_tile_left = (new_p1x // ConfigJogo.TAM_TILE, new_p1y // ConfigJogo.TAM_TILE)
new_p1_tile_right = ((new_p1x + ConfigJogo.TAM_TILE - 1) // ConfigJogo.TAM_TILE, new_p1y // ConfigJogo.TAM_TILE)
new_p1_tile_down = (new_p1x // ConfigJogo.TAM_TILE, (new_p1y + ConfigJogo.TAM_TILE - 1) // ConfigJogo.TAM_TILE)
if bomba_tile in [new_p1_tile_left, new_p1_tile_right, new_p1_tile_down]:
bombaColisao = True
if bomba.explosao: # colisao com a explosao
for rect in bomba.explosoes:
if rect.colliderect(self.p1.colisao):
if time.time() - self.p1.time_inalvejavel > 5:
self.p1.set_vida(self.p1.get_vida() - 1)
if self.p1.get_vida() == 0:
self.p1.morto = True
return
else:
new_p1x = ConfigJogo.TAM_TILE
new_p1y = ConfigJogo.TAM_TILE + ConfigJogo.ALTURA_MENU
self.p1.time_inalvejavel=time.time()
if not bombaColisao:
self.p1.setX(new_p1x)
self.p1.setY(new_p1y)
self.p1.colisao = self.p1.personagem.get_rect(topleft=(new_p1x, new_p1y))
self.p1._time_last_move = time.time()
if self.p2:
if self.p2.morto:
self.p2.setX(-100)
self.p2.setY(-100)
else:
self.verifica_aura(self.p2)
if tempo - self.p2._time_last_move > self.p2.cd:
if tempo - self.p2.time_inalvejavel < 5:
if ((tempo - self.p2.time_inalvejavel) % 0.5) < 0.25:
self.p2.personagem.set_alpha(100)
else:
self.p2.personagem.set_alpha(190)
else:
self.p2.personagem.set_alpha(255)
new_p2x = self.p2.getX()
new_p2y = self.p2.getY()
if pygame.key.get_pressed()[pygame.K_LEFT]:
if (self.p2.getY()%ConfigJogo.TAM_TILE)<15 and (self.p2.getY()%ConfigJogo.TAM_TILE)!=0 and self.p2.getMapa().destrutivel(self.p2.getX()-1, self.p2.getY()+int(ConfigJogo.TAM_TILE/2))==TileType.GRAMA.value:
new_p2y = self.p2.getY() - ConfigJogo.VELOCIDADE_PERSONAGEM
elif (self.p2.getY()%ConfigJogo.TAM_TILE)>17 and self.p2.getMapa().destrutivel(self.p2.getX()-1, self.p2.getY()+int(ConfigJogo.TAM_TILE/2))==TileType.GRAMA.value:
new_p2y = self.p2.getY() + ConfigJogo.VELOCIDADE_PERSONAGEM
else:
new_p2x = self.p2.getX() - ConfigJogo.VELOCIDADE_PERSONAGEM
if self.quartel.quartel_colisao(new_p2x, new_p2y):
self.p2.colisao_quartel = True
else:
self.p2.colisao_quartel = False
if pygame.key.get_pressed()[pygame.K_RIGHT]:
if (self.p2.getY()%ConfigJogo.TAM_TILE)<15 and (self.p2.getY()%ConfigJogo.TAM_TILE)!=0 and self.p2.getMapa().destrutivel(self.p2.getX()+ConfigJogo.TAM_TILE+1, self.p2.getY()+int(ConfigJogo.TAM_TILE/2))==TileType.GRAMA.value:
new_p2y = self.p2.getY() - ConfigJogo.VELOCIDADE_PERSONAGEM
elif (self.p2.getY()%ConfigJogo.TAM_TILE)>17 and self.p2.getMapa().destrutivel(self.p2.getX()+ConfigJogo.TAM_TILE+1, self.p2.getY()+int(ConfigJogo.TAM_TILE/2))==TileType.GRAMA.value:
new_p2y = self.p2.getY() + ConfigJogo.VELOCIDADE_PERSONAGEM
else:
new_p2x = self.p2.getX() + ConfigJogo.VELOCIDADE_PERSONAGEM
if self.quartel.quartel_colisao(new_p2x + ConfigJogo.TAM_TILE, new_p2y):
self.p2.colisao_quartel = True
else:
self.p2.colisao_quartel = False
if pygame.key.get_pressed()[pygame.K_DOWN]:
if (self.p2.getX()%ConfigJogo.TAM_TILE)<15 and (self.p2.getX()%ConfigJogo.TAM_TILE)!=0 and self.p2.getMapa().destrutivel(self.p2.getX()+int(ConfigJogo.TAM_TILE/2), self.p2.getY()+ConfigJogo.TAM_TILE+1)==TileType.GRAMA.value:
new_p2x = self.p2.getX() - ConfigJogo.VELOCIDADE_PERSONAGEM
elif (self.p2.getX()%ConfigJogo.TAM_TILE)>17 and self.p2.getMapa().destrutivel(self.p2.getX()+int(ConfigJogo.TAM_TILE/2), self.p2.getY()+ConfigJogo.TAM_TILE+1)==TileType.GRAMA.value:
new_p2x = self.p2.getX() + ConfigJogo.VELOCIDADE_PERSONAGEM
else:
new_p2y = self.p2.getY() + ConfigJogo.VELOCIDADE_PERSONAGEM
if self.quartel.quartel_colisao(new_p2x, new_p2y + ConfigJogo.TAM_TILE):
self.p2.colisao_quartel = True
else:
self.p2.colisao_quartel = False
if pygame.key.get_pressed()[pygame.K_UP]:
if (self.p2.getX()%ConfigJogo.TAM_TILE)<15 and (self.p2.getX()%ConfigJogo.TAM_TILE)!=0 and self.p2.getMapa().destrutivel(self.p2.getX()+int(ConfigJogo.TAM_TILE/2), self.p2.getY()-1)==TileType.GRAMA.value:
new_p2x = self.p2.getX() - ConfigJogo.VELOCIDADE_PERSONAGEM
elif (self.p2.getX()%ConfigJogo.TAM_TILE)>17 and self.p2.getMapa().destrutivel(self.p2.getX()+int(ConfigJogo.TAM_TILE/2), self.p2.getY()-1)==TileType.GRAMA.value:
new_p2x = self.p2.getX() + ConfigJogo.VELOCIDADE_PERSONAGEM
else:
new_p2y = self.p2.getY() - ConfigJogo.VELOCIDADE_PERSONAGEM
if self.quartel.quartel_colisao(new_p2x, new_p2y):
self.p2.colisao_quartel = True
else:
self.p2.colisao_quartel = False
#COLISAO COM PERSONAGEM E PROJETIL
for inimigo in self.inimigos:
if self.p2.colisao.colliderect(inimigo.colisao):
if time.time() - self.p2.time_inalvejavel > 5:
self.p2.set_vida(self.p2.get_vida() - 1)
if self.p2.get_vida() == 0:
self.p2.morto = True
return
else:
new_p2x = ConfigJogo.LARGURA_TELA - 2*ConfigJogo.TAM_TILE
new_p2y = ConfigJogo.ALTURA_TELA - 2*ConfigJogo.TAM_TILE
self.p2.time_inalvejavel=time.time()
if type(inimigo) == Alienigena:
for projetil in inimigo.projeteis:
if self.p2.colisao.colliderect(projetil.colisao):
projetil.colidido = True
inimigo.projeteis.remove(projetil)
if time.time() - self.p2.time_inalvejavel > 5:
self.p2.set_vida(self.p2.get_vida() - 1)
if self.p2.get_vida() == 0:
self.p2.morto = True
return
else:
new_p2x = ConfigJogo.LARGURA_TELA - 2*ConfigJogo.TAM_TILE
new_p2y = ConfigJogo.ALTURA_TELA - 2*ConfigJogo.TAM_TILE
self.p2.time_inalvejavel=time.time()
if not self.p2.getMapa().is_any_wall(new_p2x, new_p2y) and not self.p2.colisao_quartel:
bombaColisao = False
for bombaVetor in self.bombas:
for bomba in bombaVetor:
if not bomba.explosao and not self.p2.colisao.colliderect(bomba.colisao): #Para não colidir após colocar a bomba
bomba_tile = (bomba.getX() // ConfigJogo.TAM_TILE, bomba.getY() // ConfigJogo.TAM_TILE)
new_p2_tile_left = (new_p2x // ConfigJogo.TAM_TILE, new_p2y // ConfigJogo.TAM_TILE)
new_p2_tile_right = ((new_p2x + ConfigJogo.TAM_TILE - 1) // ConfigJogo.TAM_TILE, new_p2y // ConfigJogo.TAM_TILE)
new_p2_tile_down = (new_p2x // ConfigJogo.TAM_TILE, (new_p2y + ConfigJogo.TAM_TILE - 1) // ConfigJogo.TAM_TILE)
if bomba_tile in [new_p2_tile_left, new_p2_tile_right, new_p2_tile_down]:
bombaColisao = True
if bomba.explosao: # colisao com a explosao
for rect in bomba.explosoes:
if rect.colliderect(self.p2.colisao):
if time.time() - self.p2.time_inalvejavel > 5:
self.p2.set_vida(self.p2.get_vida() - 1)
if self.p2.get_vida() == 0:
self.p2.morto = True
return
else:
new_p2x = ConfigJogo.LARGURA_TELA - 2*ConfigJogo.TAM_TILE
new_p2y = ConfigJogo.ALTURA_TELA - 2*ConfigJogo.TAM_TILE
self.p2.time_inalvejavel=time.time()
if not bombaColisao:
self.p2.setX(new_p2x)
self.p2.setY(new_p2y)
self.p2.colisao = self.p2.personagem.get_rect(topleft=(new_p2x, new_p2y))
self.p2._time_last_move = time.time()
def desenha_menu(self):
pygame.draw.rect(self.tela, ConfigJogo.COR_HUD, (0, 0, ConfigJogo.LARGURA_TELA, ConfigJogo.ALTURA_MENU))
pygame.draw.rect(self.tela, ConfigJogo.COR_BORDA_HUD, (0, 0, ConfigJogo.LARGURA_TELA, ConfigJogo.ALTURA_MENU), 4)
fonte_hud = pygame.font.SysFont(None, ConfigJogo.FONTE_HUD)
tempo_restante = int(ConfigJogo.DURACAO_JOGO - self.cronometro.tempo_passado())
minutos = tempo_restante // 60
segundos = tempo_restante % 60
if segundos >= 10:
mostra_tempo = fonte_hud.render(f'{minutos:.0f}:{segundos:.0f}', True, ConfigJogo.COR_FONTE_HUD)
else:
mostra_tempo = fonte_hud.render(f'{minutos:.0f}:0{segundos:.0f}', True, ConfigJogo.COR_FONTE_HUD)
self.tela.blit(mostra_tempo, (ConfigJogo.LARGURA_TELA * .12, ConfigJogo.ALTURA_MENU * .5 - ConfigJogo.TAM_TILE * .5))
self.tela.blit(self.img_relogio, (ConfigJogo.LARGURA_TELA * .05, ConfigJogo.ALTURA_MENU * .5 - ConfigJogo.TAM_TILE * .5))
if not self.p2:
self.tela.blit(self.p1.personagem, (ConfigJogo.LARGURA_TELA * .5, ConfigJogo.ALTURA_MENU * .5 - ConfigJogo.TAM_TILE * .5))
mostra_pont_p1 = fonte_hud.render(f'{self.p1.get_pontos()}', True, ConfigJogo.COR_FONTE_HUD)
self.tela.blit(mostra_pont_p1, (ConfigJogo.LARGURA_TELA * .57, ConfigJogo.ALTURA_MENU * .5 - ConfigJogo.TAM_TILE * .5))
self.tela.blit(self.img_relogio, (ConfigJogo.LARGURA_TELA * .05, ConfigJogo.ALTURA_MENU * .5 - ConfigJogo.TAM_TILE * .5))
else:
mostra_pont_p1 = fonte_hud.render(f'{self.p1.get_pontos()}', True, ConfigJogo.COR_FONTE_HUD)
mostra_pont_p2 = fonte_hud.render(f'{self.p2.get_pontos()}', True, ConfigJogo.COR_FONTE_HUD)
self.tela.blit(mostra_pont_p1, (ConfigJogo.LARGURA_TELA * .57, ConfigJogo.ALTURA_MENU * .5 - ConfigJogo.TAM_TILE * .5), 255)
self.tela.blit(mostra_pont_p2, (ConfigJogo.LARGURA_TELA * .82, ConfigJogo.ALTURA_MENU * .5 - ConfigJogo.TAM_TILE * .5), 255)
self.tela.blit(self.p1.personagem, (ConfigJogo.LARGURA_TELA * .5, ConfigJogo.ALTURA_MENU * .5 - ConfigJogo.TAM_TILE * .5))
self.tela.blit(self.p2.personagem, (ConfigJogo.LARGURA_TELA * .75, ConfigJogo.ALTURA_MENU * .5 - ConfigJogo.TAM_TILE * .5))