lives update
parent
f92bc14d3a
commit
3873239ebc
5
main.py
5
main.py
|
@ -142,6 +142,9 @@ while run:
|
||||||
elif entity.type == "button":
|
elif entity.type == "button":
|
||||||
entity.blit_button(screen)
|
entity.blit_button(screen)
|
||||||
|
|
||||||
|
elif entity.type == "hand_screen":
|
||||||
|
entity.hand_blit(screen, game_screen.lives)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
screen.blit(entity.surf, entity.rect)
|
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))
|
rect = surf.get_rect(center=(s.SCREEN_WIDTH / 2, s.SCREEN_HEIGHT / 2))
|
||||||
screen.blit(surf, rect)
|
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()
|
pygame.display.flip()
|
||||||
|
|
|
@ -10,7 +10,6 @@ from json import dumps
|
||||||
pygame.font.init()
|
pygame.font.init()
|
||||||
my_font = pygame.font.SysFont('Calibri (Body)', 50)
|
my_font = pygame.font.SysFont('Calibri (Body)', 50)
|
||||||
|
|
||||||
|
|
||||||
class Hand_screen(pygame.sprite.Sprite):
|
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))
|
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):
|
class Button(pygame.sprite.Sprite):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
Loading…
Reference in New Issue