2022-03-10 18:34:58 +01:00
|
|
|
import pygame.image
|
2022-03-24 12:54:22 +01:00
|
|
|
import random
|
2022-03-10 18:34:58 +01:00
|
|
|
|
2022-04-10 20:28:50 +02:00
|
|
|
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"),
|
|
|
|
]
|
2022-03-10 18:34:58 +01:00
|
|
|
|
2022-03-24 21:45:17 +01:00
|
|
|
|
2022-04-10 20:28:50 +02:00
|
|
|
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))
|
|
|
|
self.rect = self.image.get_rect(topleft=position)
|
2022-03-24 21:45:17 +01:00
|
|
|
|
2022-03-24 12:54:22 +01:00
|
|
|
self.health = random.randrange(15, 25)
|
|
|
|
self.attack = random.randrange(2, 10)
|
2022-04-10 20:28:50 +02:00
|
|
|
if self.image == monster_images[0]:
|
2022-03-24 21:45:17 +01:00
|
|
|
self.health = 20
|
|
|
|
self.attack = 9
|
|
|
|
self.points = 10
|
2022-04-10 20:28:50 +02:00
|
|
|
elif self.image == monster_images[1]:
|
2022-03-24 21:45:17 +01:00
|
|
|
self.health = 15
|
|
|
|
self.attack = 7
|
|
|
|
self.points = 7
|
2022-04-10 20:28:50 +02:00
|
|
|
elif self.image == monster_images[2]:
|
2022-03-24 21:45:17 +01:00
|
|
|
self.health = 10
|
|
|
|
self.attack = 4
|
|
|
|
self.points = 4
|
2022-04-10 20:28:50 +02:00
|
|
|
elif self.image == monster_images[3]:
|
2022-03-24 21:45:17 +01:00
|
|
|
self.health = 7
|
|
|
|
self.attack = 2
|
|
|
|
self.points = 2
|