from gamedata.objects.ingame.ennemies.ennemy import Ennemy class Balloon(Ennemy): def __init__(self,*args): super().__init__(*args) self.sprites = self.game.getSpriteDir("balloon/") self.deadsprite = self.game.sprite_lib["balloon/broke.png"] self.rect[2],self.rect[3] = self.sprites[0].get_size() self.rect[3]*=0.6 self.spriteindex = 0 self.animspeed = 2 self.flip = False self.canhit = False def step(self): super().step() self.spriteindex+=self.animspeed*self.game.dt self.sprite = self.sprites[int(self.spriteindex)%len(self.sprites)] self.flip = self.player.rect.center[0]>self.rect.center[0] def draw(self): if not self.dead: index = int(self.spriteindex)%len(self.sprites) veroffset = [0,2,0,-2][index] sprite = self.game.pygame.transform.flip(self.sprite,self.flip,False) self.game.window.blit(sprite,[self.rect[0]-self.game.globals["camerax"],self.rect[1]-self.game.globals["cameray"]+veroffset])