import pygame.image import random from common.helpers import parse_cord monster_images = [ pygame.image.load("./resources/textures/dragon2.png"), pygame.image.load("./resources/textures/birb.png"), pygame.image.load("./resources/textures/wolfart.png"), pygame.image.load("./resources/textures/goblin.png"), ] class Monster(pygame.sprite.Sprite): def __init__(self, position, group): super().__init__(group) self.image = random.choice(monster_images) self.image = pygame.transform.scale(self.image, (40, 40)) position_in_px = (parse_cord(position[0]), parse_cord(position[1])) self.rect = self.image.get_rect(topleft=position_in_px) self.health = random.randrange(15, 25) self.attack = random.randrange(2, 10) if self.image == monster_images[0]: self.health = 20 self.attack = 9 self.points = 10 elif self.image == monster_images[1]: self.health = 15 self.attack = 7 self.points = 7 elif self.image == monster_images[2]: self.health = 10 self.attack = 4 self.points = 4 elif self.image == monster_images[3]: self.health = 7 self.attack = 2 self.points = 2