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

31 lines
883 B
Python
Raw Normal View History

2021-11-21 12:28:27 +01:00
from gamedata.objects.ingame.ennemies.ennemy import Ennemy
2021-11-17 16:14:29 +01:00
class Crate(Ennemy):
2021-11-18 17:58:38 +01:00
def __init__(self,*args):
2021-11-17 16:14:29 +01:00
2021-11-18 17:58:38 +01:00
super().__init__(*args)
2021-11-17 16:14:29 +01:00
2021-11-18 17:58:38 +01:00
self.sprite = self.game.sprite_lib["crate/crate.png"]
self.deadsprite = self.game.sprite_lib["crate/broke.png"]
2021-11-17 16:14:29 +01:00
2021-11-18 08:48:29 +01:00
self.size = self.sprite.get_size()
self.rect[2],self.rect[3] = self.size
2021-11-17 16:42:10 +01:00
self.canhit = False
2021-11-17 16:14:29 +01:00
2021-11-18 08:48:29 +01:00
# Add his own rects to the solid list
self.collisionrects.append(self.rect)
2021-11-17 16:14:29 +01:00
def step(self):
super().step()
2021-11-18 08:48:29 +01:00
if self.dead:
# Remove his own solid
self.rect[2],self.rect[3] = 0,0
else:
self.rect[2],self.rect[3] = self.size
2021-11-17 16:14:29 +01:00
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"]])