From b4da4319b8c0fc1fa0d9d3826a37a17fa234587c Mon Sep 17 00:00:00 2001 From: GeorgeTom17 <51702013+GeorgeTom17@users.noreply.github.com> Date: Thu, 10 Mar 2022 18:34:58 +0100 Subject: [PATCH] added monsters --- game.py | 6 ++++-- monster.py | 18 ++++++++++++++++++ resources/textures/dragon.png | Bin 0 -> 1762 bytes 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 monster.py create mode 100644 resources/textures/dragon.png diff --git a/game.py b/game.py index 87956ec..e0fee48 100644 --- a/game.py +++ b/game.py @@ -8,6 +8,7 @@ from helpers import draw_text from logs import Logs from stats import Stats from knight import Knight +from monster import Monster class Game: @@ -111,7 +112,6 @@ class Game: grid = Grid(self.tiles) stats = Stats() logs = Logs() - while running: self.screen.blit(self.bg, (0, 0)) @@ -131,6 +131,8 @@ class Game: knights_list = pygame.sprite.Group() knights_list.add(knight1) knights_list.draw(self.screen) - + monster1 = Monster(self.screen, "/resources/textures/dragon.png") + monster_list = pygame.sprite.Group() + monster_list.add(monster1) pygame.display.update() self.clock.tick(FPS_COUNT) diff --git a/monster.py b/monster.py new file mode 100644 index 0000000..9b7b5e5 --- /dev/null +++ b/monster.py @@ -0,0 +1,18 @@ +import pygame.image +import random + + +class Monster(pygame.sprite.Sprite): + + def __init__(self, screen, img): + super().__init__() + self.images = [] + self.image = pygame.image.load("resources/textures/dragon.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)) diff --git a/resources/textures/dragon.png b/resources/textures/dragon.png new file mode 100644 index 0000000000000000000000000000000000000000..9dd657b8c8232e2df479c0fa25b27a6ebf961fd2 GIT binary patch literal 1762 zcmaJ?X*3%M7fm#32@PVI#?~PAZHf}nS}NA63jHc}(ow1yOKr7;l#1G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