37 lines
1.0 KiB
Python
37 lines
1.0 KiB
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
|
|
self.respawn = False
|
|
|
|
# Add his own rects to the solid list
|
|
self.collisionrects.append(self.rect)
|
|
|
|
self.game.globals["totaltrashes"]+=1
|
|
|
|
def deadtrigger(self):
|
|
self.game.globals["trashes"]+=1
|
|
|
|
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"]])
|