Overflown/gamedata/objects/combat/ennemies/crate.py

31 lines
896 B
Python

from gamedata.objects.combat.ennemies.ennemy import Ennemy
class Crate(Ennemy):
def __init__(self,x,y,game,nodes=None):
super().__init__(x,y,game,nodes)
self.sprite = game.sprite_lib["crate/crate.png"]
self.deadsprite = game.sprite_lib["crate/broke.png"]
self.size = self.sprite.get_size()
self.rect[2],self.rect[3] = self.size
self.canhit = False
# Add his own rects to the solid list
self.collisionrects.append(self.rect)
def step(self):
super().step()
if self.dead:
# Remove his own solid
self.rect[2],self.rect[3] = 0,0
else:
self.rect[2],self.rect[3] = self.size
def draw(self):
if not self.dead:
self.game.window.blit(self.sprite,[self.rect[0]-self.game.globals["camerax"],self.rect[1]-self.game.globals["cameray"]])