liczenie rycerzy dziala

This commit is contained in:
XsedoX 2022-04-28 21:50:12 +02:00
parent fe964ceb7e
commit 9f3c5fb2d5
2 changed files with 6 additions and 9 deletions

View File

@ -27,7 +27,6 @@ class Game:
self.screens = {'credits': Credits(self.screen, self.clock), 'options': Options(self.screen, self.clock)}
def main_menu(self):
menu = MainMenu(self.screen, self.clock, self.bg,
self.game,
@ -38,7 +37,7 @@ class Game:
def game(self):
logs = Logs(self.screen)
level = Level(self.screen, logs)
stats = Stats(self.screen)
stats = Stats(self.screen, level.list_knights_blue, level.list_knights_red)
# setup clock for rounds
NEXT_TURN = pygame.USEREVENT + 1

View File

@ -8,8 +8,10 @@ from common.helpers import draw_text
class Stats:
def __init__(self, screen):
def __init__(self, screen, list_knights_blue, list_knights_red):
self.grid = []
self.list_knights_blue = list_knights_blue
self.list_knights_red = list_knights_red
self.screen = screen
self.x = (GRID_CELL_PADDING + GRID_CELL_SIZE) * COLUMNS + BORDER_WIDTH + 15
self.y = 5
@ -33,16 +35,12 @@ class Stats:
draw_text('VS', FONT_DARK, self.screen, self.x + 150, self.y + 120, 36)
# HP bars
#pygame.draw.rect(screen, RED, pygame.Rect(x + 30, y + 210, 100, 15), 0, 4)
#pygame.draw.rect(screen, RED, pygame.Rect(x + 210, y + 210, 100, 15), 0, 4)
self.red_team_hp_bar.update()
self.blue_team_hp_bar.update()
# texts
draw_text('Rycerze: 2', FONT_DARK, self.screen, self.x + 35, self.y + 240, 18)
draw_text('Fortece: 1', FONT_DARK, self.screen, self.x + 35, self.y + 270, 18)
draw_text('Rycerze: ' + str(len(self.list_knights_blue)), FONT_DARK, self.screen, self.x + 35, self.y + 240, 18) # blue
draw_text('Fortece: ' + str(len(self.list_knights_red)), FONT_DARK, self.screen, self.x + 35, self.y + 270, 18) # red
draw_text('Rycerze: 4', FONT_DARK, self.screen, self.x + 215, self.y + 240, 18)
draw_text('Fortece: 0', FONT_DARK, self.screen, self.x + 215, self.y + 270, 18)