Mercurial > touhou
changeset 246:cb329dca4758
Use the correct behaviour for flag 1 in bullet.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 15 Jan 2012 15:22:26 +0100 |
parents | d3ba32a9096e |
children | fb3a263213d1 |
files | pytouhou/game/bullet.py |
diffstat | 1 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/pytouhou/game/bullet.py +++ b/pytouhou/game/bullet.py @@ -114,11 +114,13 @@ class Bullet(object): def launch(self): self._launched = True - self.update = self.update_full self.set_anim() if self.flags & 1: self.speed_interpolator = Interpolator((self.speed + 5.,), 0, (self.speed,), 16) + self.update = self.update_speed + else: + self.update = self.update_full def collide(self): @@ -173,6 +175,18 @@ class Bullet(object): self.y += dy + def update_speed(self): + if self.speed_interpolator: + self.speed_interpolator.update(self.frame) + self.speed, = self.speed_interpolator.values + dx, dy = cos(self.angle) * self.speed, sin(self.angle) * self.speed + self.x, self.y = self.x + dx, self.y + dy + self.frame += 1 + else: + self.update = self.update_full + self.update() + + def update_full(self): sprite = self._sprite