added monsters

This commit is contained in:
GeorgeTom17 2022-03-10 18:34:58 +01:00
parent bfe6405331
commit b4da4319b8
3 changed files with 22 additions and 2 deletions

View File

@ -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)

18
monster.py Normal file
View File

@ -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))

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB