comparison pytouhou/game/laser.py @ 467:5bb7d2c0ff46

Fix lasers sprite handling
author Thibaut Girka <thib@sitedethib.com>
date Thu, 12 Sep 2013 14:43:38 +0200
parents b9d2db93972f
children
comparison
equal deleted inserted replaced
466:b16d34fca5b4 467:5bb7d2c0ff46
181 else: 181 else:
182 width = self.width * (1. - float(self.frame) / self.stop_duration) #TODO 182 width = self.width * (1. - float(self.frame) / self.stop_duration) #TODO
183 183
184 offset = self.end_offset - length / 2. 184 offset = self.end_offset - length / 2.
185 self.x, self.y = self.base_pos[0] + offset * cos(self.angle), self.base_pos[1] + offset * sin(self.angle) 185 self.x, self.y = self.base_pos[0] + offset * cos(self.angle), self.base_pos[1] + offset * sin(self.angle)
186 self.sprite.width_override = width or 0.01 #TODO 186 self.sprite.visible = (width > 0 and length > 0)
187 self.sprite.height_override = length or 0.01 #TODO 187 self.sprite.width_override = width
188 self.sprite.height_override = length
188 189
189 self.sprite.update_orientation(pi/2. - self.angle, True) 190 self.sprite.update_orientation(pi/2. - self.angle, True)
190 self.sprite.changed = True #TODO 191 self.sprite.changed = True #TODO
191 192
192 self.frame += 1 193 self.frame += 1
245 246
246 length = self.origin.y 247 length = self.origin.y
247 if self.frame == self.duration: 248 if self.frame == self.duration:
248 self.cancel() 249 self.cancel()
249 250
250 self.sprite.height_override = length or 0.01 #TODO 251 self.sprite.visible = (length > 0)
252 self.sprite.height_override = length
251 self.sprite.changed = True #TODO 253 self.sprite.changed = True #TODO
252 254
253 self.frame += 1 255 self.frame += 1
254 256