import random import pygame.image from common.helpers import parse_cord from logic.health_bar import HealthBar class Castle(pygame.sprite.Sprite): def __init__(self, screen, position, group): super().__init__(group) self._layer = 1 self.image = pygame.image.load("./resources/textures/castle.png").convert_alpha() self.image = pygame.transform.scale(self.image, (78, 78)) self.position = position position_in_px = (parse_cord(position[0]), parse_cord(position[1])) self.rect = self.image.get_rect(center=position_in_px) self.max_hp = 80 self.health_bar = HealthBar(screen, self.rect, current_hp=self.max_hp, max_hp=self.max_hp, calculate_xy=True, calculate_size=True) def update(self): self.health_bar.update()