35 lines
924 B
Python
35 lines
924 B
Python
from gamedata.objects.ingame.ennemies.ennemy import Ennemy
|
|
|
|
class Projectile(Ennemy):
|
|
|
|
def __init__(self,*args):
|
|
|
|
super().__init__(*args)
|
|
|
|
self.flip = self.customvalues["flip"]
|
|
self.sprite = self.game.pygame.transform.flip(self.game.sprite_lib["shooter/spike.png"],self.flip,False)
|
|
self.rect[2],self.rect[3] = self.sprite.get_size()
|
|
self.rect[0]-=(self.rect[2])/2
|
|
self.rect[1]-=(self.rect[3])/2
|
|
|
|
self.spd = 120
|
|
self.candie = False
|
|
self.collisions = False
|
|
|
|
def step(self):
|
|
|
|
movement = -self.spd*self.game.dt
|
|
if self.flip:
|
|
movement*=-1
|
|
|
|
self.horspd=movement
|
|
|
|
super().step()
|
|
|
|
if not self.onscreen:
|
|
self.game.gameloop.delid(self.id)
|
|
|
|
def draw(self):
|
|
|
|
self.game.window.blit(self.sprite,[self.rect[0]-self.game.globals["camerax"],self.rect[1]-self.game.globals["cameray"]])
|