lives update

master
IljaP 2024-04-26 09:16:10 +03:00
parent f92bc14d3a
commit 3873239ebc
2 changed files with 9 additions and 2 deletions

View File

@ -142,6 +142,9 @@ while run:
elif entity.type == "button":
entity.blit_button(screen)
elif entity.type == "hand_screen":
entity.hand_blit(screen, game_screen.lives)
else:
screen.blit(entity.surf, entity.rect)
@ -194,6 +197,6 @@ while run:
rect = surf.get_rect(center=(s.SCREEN_WIDTH / 2, s.SCREEN_HEIGHT / 2))
screen.blit(surf, rect)
screen.blit(text, (s.SCREEN_WIDTH / 2 - 250, s.SCREEN_HEIGHT / 2 - 100))
screen.blit(text, (s.SCREEN_WIDTH / 2, s.SCREEN_HEIGHT / 2))
pygame.display.flip()

View File

@ -10,7 +10,6 @@ from json import dumps
pygame.font.init()
my_font = pygame.font.SysFont('Calibri (Body)', 50)
class Hand_screen(pygame.sprite.Sprite):
"""рука игрока"""
@ -26,6 +25,11 @@ class Hand_screen(pygame.sprite.Sprite):
self.rect = self.surf.get_rect(center=(self.pos[0] + s.SCREEN_WIDTH / 2, self.pos[1] + self.h / 2))
def hand_blit(self, screen, lives):
screen.blit(self.surf, self.rect)
text = my_font.render(f"Lives: {lives}", True, (255, 255, 255))
screen.blit(text, (s.SCREEN_WIDTH - 250, s.SCREEN_HEIGHT - 100))
class Button(pygame.sprite.Sprite):
def __init__(self):