Mercurial > touhou
changeset 183:b6d7ce644f34
Implement two new ECL instructions.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Wed, 26 Oct 2011 02:27:00 -0700 |
parents | 20843875ad8f |
children | 54eb6b254b7b |
files | pytouhou/game/enemy.py pytouhou/vm/eclrunner.py |
diffstat | 2 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/pytouhou/game/enemy.py +++ b/pytouhou/game/enemy.py @@ -28,6 +28,7 @@ class Enemy(object): self._sprite = None self._anmrunner = None self._removed = False + self._visible = True self._type = _type self._bonus_dropped = bonus_dropped self._die_score = die_score #TODO: use it @@ -101,7 +102,6 @@ class Enemy(object): self.bullet_launch_interval = int(value) self.bullet_launch_timer = int(value * start) - print(self.bullet_launch_interval, self.bullet_launch_timer) def fire(self): @@ -280,7 +280,7 @@ class Enemy(object): if self._anmrunner and not self._anmrunner.run_frame(): self._anmrunner = None - if self._sprite: + if self._sprite and self._visible: if self._sprite._removed: self._sprite = None else:
--- a/pytouhou/vm/eclrunner.py +++ b/pytouhou/vm/eclrunner.py @@ -515,6 +515,12 @@ class ECLRunner(object): self._enemy.angle = self._enemy.get_player_angle() + @instruction(52) + def move_in_decel(self, duration, angle, speed): + self._enemy.angle, self._enemy.speed = angle, speed + self._enemy.stop_in(duration, lambda x: 2. * x - x ** 2) + + @instruction(56) def move_to_linear(self, duration, x, y, z): self._enemy.move_to(duration, @@ -923,6 +929,13 @@ class ECLRunner(object): self._enemy.remaining_lives = lives + @instruction(132) + def set_visible(self, value): + self._enemy._visible = bool(value) + if self._enemy._sprite: + self._enemy._sprite._removed = bool(value) + + @instruction(131) def set_difficulty_coeffs(self, speed_a, speed_b, nb_a, nb_b, shots_a, shots_b): self._enemy.difficulty_coeffs = (speed_a, speed_b, nb_a, nb_b, shots_a, shots_b)