monsters v2 (max będzie v4) #9

Merged
s446093 merged 1 commits from monster_update into master 2022-03-24 13:10:19 +01:00
4 changed files with 8 additions and 14 deletions
Showing only changes of commit 25d46a1baf - Show all commits

View File

@ -103,12 +103,12 @@ class Game:
spawn_left_team.spawn()
spawn_right_team.spawn()
spawned_monsters = self.generate_monster((monsters_sprite_group))
spawned_monsters = self.generate_monster(monsters_sprite_group)
monster_spawn = Spawner(grid, spawned_monsters, width=MONSTER_SPAWN_WIDTH, height=MONSTER_SPAWN_HEIGHT,
pos_row = MONSTER_SPAWN_FIRST_ROW, pos_column=MONSTER_SPAWN_FIRST_COL)
monster_spawn.spawn_monster()
monster_spawn.spawn_monsters()
while running:
self.screen.blit(self.bg, (0, 0))
@ -127,9 +127,6 @@ class Game:
knights_sprite_group.draw(self.screen)
monsters_sprite_group.draw(self.screen)
# monster1 = Monster(self.screen)
# monster_list = pygame.sprite.Group()
# monster_list.add(monster1)
pygame.display.update()
self.clock.tick(FPS_COUNT)
@ -145,7 +142,8 @@ class Game:
@staticmethod
def generate_monster(monsters_sprite_group):
monsters = []
monster1 = Monster()
monsters.append(monster1)
monsters_sprite_group.add(monster1)
for i in range(2):
monster = Monster()
monsters.append(monster)
monsters_sprite_group.add(monster)
return monsters

View File

@ -27,7 +27,7 @@ class Spawner:
coords.pop(random_tile)
obj.update()
def spawn_monster(self):
def spawn_monsters(self):
coords = []
for row in range(self.pos_row, (self.pos_row + self.width)):
for column in range(self.pos_column, (self.pos_column + self.height)):

View File

@ -8,14 +8,10 @@ class Monster(pygame.sprite.Sprite):
def __init__(self):
super().__init__()
self.image = pygame.image.load("./resources/textures/dragon.png")
self.image = pygame.image.load("./resources/textures/dragon2.png")
self.image = pygame.transform.scale(self.image, (40, 40))
self.images.append(self.image)
self.rect = self.image.get_rect()
monster_list = pygame.sprite.Group()
#x = 337 + 41 * 5
#y = 214 + 41 * 7
#pygame.draw.rect(screen, (255, 255, 255), pygame.Rect(x, y, 40, 40), 0, 0)
#screen.blit(self.image, (x, y))
self.health = random.randrange(15, 25)
self.attack = random.randrange(2, 10)

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB