comparison pytouhou/vm/eclrunner.py @ 107:5d9052b9a4e8

(almost) implement Cirno's freezing spellcard
author Thibaut Girka <thib@sitedethib.com>
date Mon, 05 Sep 2011 23:04:43 +0200
parents c7847bfed427
children 8ba018617829
comparison
equal deleted inserted replaced
106:c7847bfed427 107:5d9052b9a4e8
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ## GNU General Public License for more details. 12 ## GNU General Public License for more details.
13 ## 13 ##
14 14
15 15
16 from math import atan2, cos, sin 16 from math import atan2, cos, sin, pi
17 17
18 from pytouhou.utils.helpers import get_logger 18 from pytouhou.utils.helpers import get_logger
19 19
20 from pytouhou.vm.common import MetaRegistry, instruction 20 from pytouhou.vm.common import MetaRegistry, instruction
21 21
761 def set_automatic_orientation(self, flags): 761 def set_automatic_orientation(self, flags):
762 #TODO: does it change anything else than the sprite's rotation? 762 #TODO: does it change anything else than the sprite's rotation?
763 self._enemy.automatic_orientation = bool(flags & 1) 763 self._enemy.automatic_orientation = bool(flags & 1)
764 764
765 765
766 @instruction(121)
767 def call_special_function(self, function, arg):
768 if function == 0: # Cirno
769 if arg == 0:
770 for bullet in self._game_state.bullets:
771 bullet.speed = bullet.angle = 0.
772 bullet.set_anim(sprite_idx_offset=0) #TODO: check
773 else:
774 for bullet in self._game_state.bullets:
775 bullet.speed = 2.0 #TODO
776 bullet.angle = self._game_state.prng.rand_double() * pi #TODO
777 else:
778 logger.warn("Unimplemented special function %d!", function)
779
780
766 @instruction(123) 781 @instruction(123)
767 def skip_frames(self, frames): 782 def skip_frames(self, frames):
768 #TODO: is that all? 783 #TODO: is that all?
769 self.frame += self._getval(frames) 784 self.frame += self._getval(frames)
770 785