diff pytouhou/game/bullet.py @ 236:741860192b56

Implement ANM0 interrupts “Instruction” 22 is used as a label for interrupts. If the normal animation is interrupted, it goes straight to the matched instruction. Interrupt -1 matches all interrupts.
author Thibaut Girka <thib@sitedethib.com>
date Sun, 01 Jan 2012 19:47:34 +0100
parents 8843e26f80c3
children cb329dca4758
line wrap: on
line diff
--- a/pytouhou/game/bullet.py
+++ b/pytouhou/game/bullet.py
@@ -19,6 +19,7 @@ from pytouhou.vm.anmrunner import ANMRun
 from pytouhou.game.sprite import Sprite
 
 
+
 class Bullet(object):
     def __init__(self, pos, bullet_type, sprite_idx_offset,
                        angle, speed, attributes, flags, target, game,
@@ -186,6 +187,7 @@ class Bullet(object):
             length, angle = self.attributes[4:6]
             angle = self.angle if angle < -900.0 else angle #TODO: is that right?
             dx, dy = dx + cos(angle) * length, dy + sin(angle) * length
+            self.speed = (dx ** 2 + dy ** 2) ** 0.5
             self.angle = sprite.angle = atan2(dy, dx)
             if sprite.automatic_orientation:
                 sprite._changed = True