healthbar #24

Merged
s464869 merged 3 commits from healthbar into master 2022-05-11 16:53:15 +02:00
2 changed files with 6 additions and 9 deletions
Showing only changes of commit 9f3c5fb2d5 - Show all commits

View File

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

View File

@ -8,8 +8,10 @@ from common.helpers import draw_text
class Stats: class Stats:
def __init__(self, screen): def __init__(self, screen, list_knights_blue, list_knights_red):
self.grid = [] self.grid = []
self.list_knights_blue = list_knights_blue
self.list_knights_red = list_knights_red
self.screen = screen self.screen = screen
self.x = (GRID_CELL_PADDING + GRID_CELL_SIZE) * COLUMNS + BORDER_WIDTH + 15 self.x = (GRID_CELL_PADDING + GRID_CELL_SIZE) * COLUMNS + BORDER_WIDTH + 15
self.y = 5 self.y = 5
@ -33,16 +35,12 @@ class Stats:
draw_text('VS', FONT_DARK, self.screen, self.x + 150, self.y + 120, 36) draw_text('VS', FONT_DARK, self.screen, self.x + 150, self.y + 120, 36)
# HP bars # 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.red_team_hp_bar.update()
self.blue_team_hp_bar.update() self.blue_team_hp_bar.update()
# texts # texts
draw_text('Rycerze: 2', FONT_DARK, self.screen, self.x + 35, self.y + 240, 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: 1', FONT_DARK, self.screen, self.x + 35, self.y + 270, 18) 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('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) draw_text('Fortece: 0', FONT_DARK, self.screen, self.x + 215, self.y + 270, 18)