Overflown/gamedata/objects/ingame/ennemies/crate.py
2021-11-21 12:28:27 +01:00

31 lines
883 B
Python

from gamedata.objects.ingame.ennemies.ennemy import Ennemy
class Crate(Ennemy):
def __init__(self,*args):
super().__init__(*args)
self.sprite = self.game.sprite_lib["crate/crate.png"]
self.deadsprite = self.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"]])