Mercurial > touhou
diff pytouhou/game/enemy.py @ 242:1d3c8c7473a2
Implement auxiliary animations of enemies like magic circles, and interruptions from ecl.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Mon, 02 Jan 2012 15:46:29 +0100 |
parents | 3cbfa2c11dec |
children | fb3a263213d1 |
line wrap: on
line diff
--- a/pytouhou/game/enemy.py +++ b/pytouhou/game/enemy.py @@ -17,6 +17,7 @@ from pytouhou.utils.interpolator import from pytouhou.vm.anmrunner import ANMRunner from pytouhou.game.sprite import Sprite from pytouhou.game.bullet import Bullet +from pytouhou.game.effect import Effect from math import cos, sin, atan2, pi @@ -75,6 +76,12 @@ class Enemy(object): self.hitbox_half_size = (0, 0) self.screen_box = None + self.aux_anm = 8 * [None] + + + def objects(self): + return [anm for anm in self.aux_anm if anm] + def set_bullet_attributes(self, type_, anim, sprite_idx_offset, bullets_per_shot, number_of_shots, speed, speed2, @@ -181,6 +188,10 @@ class Enemy(object): self._game.new_particle((self.x, self.y), color, 4., 256) #TODO: find the real size. + def set_aux_anm(self, number, script): + self.aux_anm[number] = Effect((self.x, self.y), script, self._anm_wrapper) + + def set_pos(self, x, y, z): self.x, self.y = x, y self.interpolator = Interpolator((x, y)) @@ -349,5 +360,11 @@ class Enemy(object): if self.touchable: self.check_collisions() + for anm in self.aux_anm: + if anm: + anm.x = self.x + anm.y = self.y + anm.update() + self.frame += 1