Mercurial > touhou
changeset 358:488c094ed51d
Make bosses clean their mess when timeouting
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sun, 08 Jul 2012 01:23:47 +0200 |
parents | 26f78fc7acea |
children | 130d258217f3 |
files | pytouhou/game/enemy.py pytouhou/game/game.py pytouhou/vm/eclrunner.py |
diffstat | 3 files changed, 15 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/pytouhou/game/enemy.py +++ b/pytouhou/game/enemy.py @@ -420,6 +420,8 @@ class Enemy(object): self.timeout_callback = -1 elif self.timeout != -1 and self.frame == self.timeout: self.timeout = -1 + self._game.kill_enemies() + self._game.cancel_bullets() if self.low_life_trigger > 0: self.life = self.low_life_trigger
--- a/pytouhou/game/game.py +++ b/pytouhou/game/game.py @@ -175,6 +175,18 @@ class Game(object): #TODO: display the final bonus score. + def kill_enemies(self): + for enemy in self.enemies: + if enemy.boss: + pass # Bosses are immune to 96 + elif enemy.touchable: + enemy.life = 0 + elif enemy.death_callback > 0: + #TODO: check + enemy.process.switch_to_sub(enemy.death_callback) + enemy.death_callback = -1 + + def new_effect(self, pos, anim, anm_wrapper=None): self.effects.append(Effect(pos, anim, anm_wrapper or self.etama4))
--- a/pytouhou/vm/eclrunner.py +++ b/pytouhou/vm/eclrunner.py @@ -761,15 +761,7 @@ class ECLRunner(object): @instruction(96) def kill_enemies(self): - for enemy in self._game.enemies: - if enemy.boss: - pass # Bosses are immune to 96 - elif enemy.touchable: - enemy.life = 0 - elif enemy.death_callback > 0: - #TODO: check - enemy.process.switch_to_sub(enemy.death_callback) - enemy.death_callback = -1 + self.game.kill_enemies() @instruction(97)