diff pytouhou/game/sprite.py @ 94:ca571697ec83

Various minor optimisations and refactoring
author Thibaut Girka <thib@sitedethib.com>
date Sun, 04 Sep 2011 20:04:00 +0200
parents 85f3b8ba3f24
children ac2e5e1c2c3c
line wrap: on
line diff
--- a/pytouhou/game/sprite.py
+++ b/pytouhou/game/sprite.py
@@ -174,11 +174,17 @@ class Sprite(object):
             self.angle = angle_base
             self.force_rotation = force_rotation
 
-        if self.rotations_speed_3d != (0., 0., 0.) or self.scale_speed != (0., 0.):
+        if self.rotations_speed_3d != (0., 0., 0.):
             ax, ay, az = self.rotations_3d
             sax, say, saz = self.rotations_speed_3d
             self.rotations_3d = ax + sax, ay + say, az + saz
-            self.rescale = self.rescale[0] + self.scale_speed[0], self.rescale[1] + self.scale_speed[1]
             self._changed = True
+
+        if self.scale_speed != (0., 0.):
+            rx, ry = self.rescale
+            rsx, rsy = self.scale_speed
+            self.rescale = rx + rsx, ry + rsy
+            self._changed = True
+
         self.frame += 1