2022-03-09 16:59:58 +01:00
|
|
|
import pygame
|
2022-04-24 22:06:20 +02:00
|
|
|
import time
|
2022-03-09 16:59:58 +01:00
|
|
|
|
2022-04-24 22:06:20 +02:00
|
|
|
from logic.health_bar import HealthBar
|
2022-03-11 19:42:17 +01:00
|
|
|
from common.colors import FONT_DARK, ORANGE, WHITE, RED
|
2022-04-10 20:28:50 +02:00
|
|
|
from common.constants import COLUMNS, GRID_CELL_PADDING, GRID_CELL_SIZE, BORDER_WIDTH, BORDER_RADIUS
|
2022-03-11 19:42:17 +01:00
|
|
|
from common.helpers import draw_text
|
2022-03-09 16:59:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Stats:
|
2022-04-24 22:06:20 +02:00
|
|
|
def __init__(self, screen):
|
2022-03-09 16:59:58 +01:00
|
|
|
self.grid = []
|
2022-04-24 22:06:20 +02:00
|
|
|
self.screen = screen
|
|
|
|
self.x = (GRID_CELL_PADDING + GRID_CELL_SIZE) * COLUMNS + BORDER_WIDTH + 15
|
|
|
|
self.y = 5
|
|
|
|
self.blue_team_hp_bar = HealthBar(self.screen, (0, 0), 50, 100, self.x + 30, self.y + 210, 100, 15)
|
|
|
|
self.red_team_hp_bar = HealthBar(self.screen, (0, 0), 50, 100, self.x + 210, self.y + 210, 100, 15)
|
2022-03-09 16:59:58 +01:00
|
|
|
|
2022-04-24 22:06:20 +02:00
|
|
|
def draw(self):
|
2022-03-09 16:59:58 +01:00
|
|
|
|
|
|
|
# background
|
2022-04-24 22:06:20 +02:00
|
|
|
pygame.draw.rect(self.screen, WHITE, pygame.Rect(self.x, self.y, 340, 450), 0, BORDER_RADIUS)
|
2022-03-09 16:59:58 +01:00
|
|
|
|
|
|
|
# title
|
2022-04-24 22:06:20 +02:00
|
|
|
draw_text('STATS', FONT_DARK, self.screen, self.x + 120, self.y + 10, 36)
|
|
|
|
pygame.draw.rect(self.screen, ORANGE, pygame.Rect(self.x, self.y + 65, 340, 3))
|
2022-03-09 16:59:58 +01:00
|
|
|
|
|
|
|
# shields
|
2022-03-11 19:42:17 +01:00
|
|
|
shield_blue = pygame.image.load('./resources/textures/shield_blue.png')
|
|
|
|
shield_red = pygame.image.load('./resources/textures/shield_red.png')
|
2022-04-24 22:06:20 +02:00
|
|
|
self.screen.blit(shield_blue, (self.x + 20, self.y + 80))
|
|
|
|
self.screen.blit(shield_red, (self.x + 200, self.y + 80))
|
|
|
|
draw_text('VS', FONT_DARK, self.screen, self.x + 150, self.y + 120, 36)
|
2022-03-09 16:59:58 +01:00
|
|
|
|
|
|
|
# HP bars
|
2022-04-24 22:06:20 +02:00
|
|
|
#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()
|
|
|
|
|
|
|
|
|
2022-03-09 16:59:58 +01:00
|
|
|
|
|
|
|
# texts
|
2022-04-24 22:06:20 +02:00
|
|
|
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)
|
2022-03-09 16:59:58 +01:00
|
|
|
|
2022-04-24 22:06:20 +02:00
|
|
|
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)
|
2022-03-09 16:59:58 +01:00
|
|
|
|
|
|
|
# points
|
2022-04-24 22:06:20 +02:00
|
|
|
pygame.draw.rect(self.screen, ORANGE, pygame.Rect(self.x, self.y + 390, 340, 3))
|
|
|
|
draw_text('PUNKTY: 10', FONT_DARK, self.screen, self.x + 35, self.y + 408, 18, True)
|
|
|
|
draw_text('PUNKTY: 10', FONT_DARK, self.screen, self.x + 215, self.y + 408, 18, True)
|