comparison pytouhou/game/enemy.py @ 366:7dc012f631dc

Fix Rumia on timeout
author Thibaut Girka <thib@sitedethib.com>
date Mon, 09 Jul 2012 22:15:07 +0200
parents 488c094ed51d
children e0e284fcb288
comparison
equal deleted inserted replaced
365:238d06c6603e 366:7dc012f631dc
417 self.process.switch_to_sub(self.low_life_callback) 417 self.process.switch_to_sub(self.low_life_callback)
418 self.low_life_callback = -1 418 self.low_life_callback = -1
419 self.low_life_trigger = -1 419 self.low_life_trigger = -1
420 self.timeout_callback = -1 420 self.timeout_callback = -1
421 elif self.timeout != -1 and self.frame == self.timeout: 421 elif self.timeout != -1 and self.frame == self.timeout:
422 self.frame = 0
422 self.timeout = -1 423 self.timeout = -1
423 self._game.kill_enemies() 424 self._game.kill_enemies()
424 self._game.cancel_bullets() 425 self._game.cancel_bullets()
425 426
426 if self.low_life_trigger > 0: 427 if self.low_life_trigger > 0:
431 self.process.switch_to_sub(self.timeout_callback) 432 self.process.switch_to_sub(self.timeout_callback)
432 self.timeout_callback = -1 433 self.timeout_callback = -1
433 #TODO: this is only done under certain (unknown) conditions! 434 #TODO: this is only done under certain (unknown) conditions!
434 # but it shouldn't hurt anyway, as the only option left is to crash! 435 # but it shouldn't hurt anyway, as the only option left is to crash!
435 elif self.death_callback > -1: 436 elif self.death_callback > -1:
436 self.process.switch_to_sub(self.death_callback) 437 self.life = 0 #TODO: do this next frame? Bypass self.touchable?
437 self.timeout_callback = -1
438 self.death_callback = -1
439 else: 438 else:
440 raise Exception('What the hell, man!') 439 raise Exception('What the hell, man!')
441 440
442 441
443 def update(self): 442 def update(self):