comparison pytouhou/vm/eclrunner.py @ 313:2ba2462afc70

Implement hardcoded function 9.
author Thibaut Girka <thib@sitedethib.com>
date Wed, 14 Mar 2012 19:07:15 +0100
parents 8d1768fa4cbb
children f0be7ea62330
comparison
equal deleted inserted replaced
312:8d1768fa4cbb 313:2ba2462afc70
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, pi 16 from math import atan2, cos, sin, pi, hypot
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
1068 n += 1 1068 n += 1
1069 bullet_attributes[8] = bullet.angle 1069 bullet_attributes[8] = bullet.angle
1070 self._enemy.fire(launch_pos=(bullet.x, bullet.y), 1070 self._enemy.fire(launch_pos=(bullet.x, bullet.y),
1071 bullet_attributes=bullet_attributes) 1071 bullet_attributes=bullet_attributes)
1072 self._setval(-10004, n) 1072 self._setval(-10004, n)
1073 elif function == 9:
1074 self._game.new_effect((self._enemy.x, self._enemy.y), 17)
1075 base_angle = pi + 2. * self._game.prng.rand_double() * pi
1076 for bullet in self._game.bullets:
1077 if bullet._bullet_type.type_id < 5 and bullet.speed == 0.:
1078 bullet.flags = 16 #TODO: check
1079 distance = hypot(bullet.x - self._enemy.x, bullet.y - self._enemy.y)
1080 angle = base_angle
1081 angle += distance /80. #TODO: This is most probably wrong
1082 bullet.attributes[4:6] = [0.01, angle] #TODO: check
1083 bullet.attributes[0] = -1 #TODO: check
1084 bullet.set_anim(sprite_idx_offset=1) #TODO: check
1073 elif function == 11: 1085 elif function == 11:
1074 self._game.new_effect((self._enemy.x, self._enemy.y), 17) 1086 self._game.new_effect((self._enemy.x, self._enemy.y), 17)
1075 self._game.prng.rand_double() #TODO: what is it for? 1087 self._game.prng.rand_double() #TODO: what is it for?
1076 for bullet in self._game.bullets: #TODO Bullet order is WRONG 1088 for bullet in self._game.bullets: #TODO Bullet order is WRONG
1077 if bullet._bullet_type.type_id < 5 and bullet.speed == 0.: 1089 if bullet._bullet_type.type_id < 5 and bullet.speed == 0.: