diff pytouhou/game/bullet.py @ 120:4300a832f033

Small refactoring and massive performance improvement
author Thibaut Girka <thib@sitedethib.com>
date Thu, 08 Sep 2011 12:46:05 +0200
parents 92772413b5a6
children 174324a4da51
line wrap: on
line diff
--- a/pytouhou/game/bullet.py
+++ b/pytouhou/game/bullet.py
@@ -116,8 +116,13 @@ class Bullet(object):
             self._launched = True
             self.set_anim()
 
-        self._anmrunner.run_frame()
-        self._sprite.update(angle_base=self.angle)
+        sprite = self._sprite
+
+        if self._anmrunner is not None and not self._anmrunner.run_frame():
+            self._anmrunner = None
+        if sprite.automatic_orientation and sprite.angle != self.angle:
+            sprite.angle = self.angle
+            sprite._changed = True
 
         #TODO: flags
         x, y = self.x, self.y