diff --git a/main.py b/main.py index 0745008..7b57afd 100644 --- a/main.py +++ b/main.py @@ -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() diff --git a/screens.py b/screens.py index 7bf3ceb..6c97f2b 100644 --- a/screens.py +++ b/screens.py @@ -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):