comparison 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
comparison
equal deleted inserted replaced
93:d167280a82fc 94:ca571697ec83
172 self.width_override = override_width 172 self.width_override = override_width
173 self.height_override = override_height 173 self.height_override = override_height
174 self.angle = angle_base 174 self.angle = angle_base
175 self.force_rotation = force_rotation 175 self.force_rotation = force_rotation
176 176
177 if self.rotations_speed_3d != (0., 0., 0.) or self.scale_speed != (0., 0.): 177 if self.rotations_speed_3d != (0., 0., 0.):
178 ax, ay, az = self.rotations_3d 178 ax, ay, az = self.rotations_3d
179 sax, say, saz = self.rotations_speed_3d 179 sax, say, saz = self.rotations_speed_3d
180 self.rotations_3d = ax + sax, ay + say, az + saz 180 self.rotations_3d = ax + sax, ay + say, az + saz
181 self.rescale = self.rescale[0] + self.scale_speed[0], self.rescale[1] + self.scale_speed[1]
182 self._changed = True 181 self._changed = True
182
183 if self.scale_speed != (0., 0.):
184 rx, ry = self.rescale
185 rsx, rsy = self.scale_speed
186 self.rescale = rx + rsx, ry + rsy
187 self._changed = True
188
183 self.frame += 1 189 self.frame += 1
184 190