comparison pytouhou/game/bullet.pyx @ 355:b5ab2ad06de8

Fix bullet cancellation... again...
author Thibaut Girka <thib@sitedethib.com>
date Sat, 07 Jul 2012 23:16:03 +0200
parents 2350147cf043
children 690b5faaa0e6
comparison
equal deleted inserted replaced
354:89ee09453906 355:b5ab2ad06de8
148 self.anmrunner = ANMRunner(bt.anm_wrapper, bt.cancel_anim_index, 148 self.anmrunner = ANMRunner(bt.anm_wrapper, bt.cancel_anim_index,
149 self.sprite, bt.launch_anim_offsets[self.sprite_idx_offset]) 149 self.sprite, bt.launch_anim_offsets[self.sprite_idx_offset])
150 self.anmrunner.run_frame() 150 self.anmrunner.run_frame()
151 self.dx, self.dy = self.dx / 2., self.dy / 2. 151 self.dx, self.dy = self.dx / 2., self.dy / 2.
152 152
153 # Change update method
154 self.state = CANCELLED 153 self.state = CANCELLED
155
156 # Do not use this one for collisions anymore
157 if self.player_bullet:
158 self._game.players_bullets.remove(self)
159 else:
160 self._game.bullets.remove(self)
161 self._game.cancelled_bullets.append(self)
162 154
163 155
164 def update(Bullet self): 156 def update(Bullet self):
165 if self.anmrunner is not None and not self.anmrunner.run_frame(): 157 if self.anmrunner is not None and not self.anmrunner.run_frame():
166 if self.state == LAUNCHING: 158 if self.state == LAUNCHING: