comparison pytouhou/game/sprite.py @ 29:afa91be769ae

Don't lose time updating off-screen enemies' sprites
author Thibaut Girka <thib@sitedethib.com>
date Fri, 12 Aug 2011 22:03:34 +0200
parents f405b947624d
children e3ba2fa966f6
comparison
equal deleted inserted replaced
28:f405b947624d 29:afa91be769ae
68 68
69 self._uvs, self._vertices = uvs, vertices 69 self._uvs, self._vertices = uvs, vertices
70 70
71 71
72 72
73 def update(self, override_width=0, override_height=0): 73 def update(self):
74 properties = {} 74 properties = {}
75 for time, instr_type, data in self.anm.scripts[self.script_index]: 75 for time, instr_type, data in self.anm.scripts[self.script_index]:
76 if time == self.frame: 76 if time == self.frame:
77 if instr_type == 15: #Return 77 if instr_type == 15: #Return
78 break 78 break
104 if 23 in properties: 104 if 23 in properties:
105 self.corner_relative_placement = True #TODO 105 self.corner_relative_placement = True #TODO
106 del properties[23] 106 del properties[23]
107 if properties: 107 if properties:
108 print('Leftover properties: %r' % properties) #TODO 108 print('Leftover properties: %r' % properties) #TODO
109 self.update_uvs_vertices(override_width, override_height)
110 return True 109 return True
111 if self.rotations_speed_3d != (0., 0., 0.): 110 if self.rotations_speed_3d != (0., 0., 0.):
112 self.update_uvs_vertices(override_width, override_height)
113 return True 111 return True
114 return False 112 return False
115 113