comparison pytouhou/game/enemy.py @ 135:c53d91300c1c

Implement instruction 74.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 23 Sep 2011 02:52:09 -0700
parents e9ac3640280b
children ea21bb37febe
comparison
equal deleted inserted replaced
134:e9ac3640280b 135:c53d91300c1c
98 98
99 player = self.select_player() 99 player = self.select_player()
100 100
101 if type_ in (67, 69, 71): 101 if type_ in (67, 69, 71):
102 launch_angle += self.get_player_angle(player, launch_pos) 102 launch_angle += self.get_player_angle(player, launch_pos)
103 if type_ in (69, 70, 71): 103 if type_ in (69, 70, 71, 74):
104 angle = 2. * pi / bullets_per_shot 104 angle = 2. * pi / bullets_per_shot
105 if type_ == 71: 105 if type_ == 71:
106 launch_angle += pi / bullets_per_shot 106 launch_angle += pi / bullets_per_shot
107 if type_ != 75: 107 if type_ != 75:
108 launch_angle -= angle * (bullets_per_shot - 1) / 2. 108 launch_angle -= angle * (bullets_per_shot - 1) / 2.
111 111
112 for shot_nb in range(number_of_shots): 112 for shot_nb in range(number_of_shots):
113 shot_speed = speed if shot_nb == 0 else speed + (speed2 - speed) * float(shot_nb) / float(number_of_shots) 113 shot_speed = speed if shot_nb == 0 else speed + (speed2 - speed) * float(shot_nb) / float(number_of_shots)
114 bullet_angle = launch_angle 114 bullet_angle = launch_angle
115 for bullet_nb in range(bullets_per_shot): 115 for bullet_nb in range(bullets_per_shot):
116 if type_ == 75: # 102.h@0x4138cf 116 if type_ == 75: # 102h.exe@0x4138cf
117 bullet_angle = self._game_state.prng.rand_double() * (launch_angle - angle) + angle 117 bullet_angle = self._game_state.prng.rand_double() * (launch_angle - angle) + angle
118 if type_ in (74, 75): # 102h.exe@0x4138cf
118 shot_speed = self._game_state.prng.rand_double() * (speed - speed2) + speed2 119 shot_speed = self._game_state.prng.rand_double() * (speed - speed2) + speed2
119 bullets.append(Bullet(launch_pos, bullet_type, sprite_idx_offset, 120 bullets.append(Bullet(launch_pos, bullet_type, sprite_idx_offset,
120 bullet_angle, shot_speed, 121 bullet_angle, shot_speed,
121 self.extended_bullet_attributes, 122 self.extended_bullet_attributes,
122 flags, player, self._game_state)) 123 flags, player, self._game_state))