From 25d46a1baf492465bad39849ab3f23b194a1e4b7 Mon Sep 17 00:00:00 2001 From: AleksandraMuczynska Date: Thu, 24 Mar 2022 13:09:43 +0100 Subject: [PATCH] =?UTF-8?q?monsters=20v2=20(max=20b=C4=99dzie=20v4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logic/game.py | 14 ++++++-------- logic/spawner.py | 2 +- models/monster.py | 6 +----- resources/textures/dragon2.png | Bin 0 -> 14273 bytes 4 files changed, 8 insertions(+), 14 deletions(-) create mode 100644 resources/textures/dragon2.png diff --git a/logic/game.py b/logic/game.py index fc6507e..1ce9d08 100644 --- a/logic/game.py +++ b/logic/game.py @@ -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 diff --git a/logic/spawner.py b/logic/spawner.py index 69caea5..6194a0e 100644 --- a/logic/spawner.py +++ b/logic/spawner.py @@ -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)): diff --git a/models/monster.py b/models/monster.py index c6be1ca..e0363b4 100644 --- a/models/monster.py +++ b/models/monster.py @@ -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) diff --git a/resources/textures/dragon2.png b/resources/textures/dragon2.png new file mode 100644 index 0000000000000000000000000000000000000000..b67a258e40137a4e57efa9d1022d34318f76f641 GIT binary patch literal 14273 zcmeHO3tW>|mdA>qR4^)29|Qr3gMBitx&{;wup7`W;-gwy#i?4cI_jiBE%H+E5&J+v z`(PV^4p>{Yy4%OB4<1uDt=ig9vFfx1GZP=5*h;2GO#vZ$&bjw~`GQn!e>?sCW_N#0 zBl&W_bInnf$XlcVl)uU5-{ASJJDXC9B=#@UotD?j^+W)IHZ@#khPvQ3+J2OYRXSwT{ zqUqaRSBEASYw-1Nhn!C5Gch&zSd~imZ%;z-lR$HXO35! z<4w}X_QYZh{MpME8eoIF;az<}&phbPa%O+^$EEKFzv1P-BP*-z>9POZZSj*ak*UMUu274IiDV00;V;qxwCqYb zniowV0}8ZYup3T(S;c@r>j^g>B~}EAw>}gu5~74>fUP$f571hs1mHJ#8Lp8|+(lrs zm=ysfYxP5OUGNkK7HlCBA=Zaxbmsi6K@p$<;*v_rd@dJdZ*7?1)SF?s8m&QflXw>~zX(*|@xlbA6+Ouo>{ z`J%??=(~+s(VOPQDFGfXpD+eh4$RfWn>Lp-mZj6YI3?oD9+0e(!iRg9D$751V&#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