diff pytouhou/game/bullet.py @ 145:30338dc33a7b

Fix bullet orientation in some cases (Meiling's last spellcard)
author Thibaut Girka <thib@sitedethib.com>
date Mon, 03 Oct 2011 22:20:03 +0200
parents c7f0fd9d2145
children 3673d55a8448
line wrap: on
line diff
--- a/pytouhou/game/bullet.py
+++ b/pytouhou/game/bullet.py
@@ -137,6 +137,9 @@ 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.angle = sprite.angle = atan2(dy, dx)
+            if sprite.automatic_orientation:
+                sprite._changed = True
             self.delta = dx, dy
             if self.frame == frame: #TODO: include last frame, or not?
                 if count > 0: