comparison pytouhou/game/enemy.py @ 109:e93a7ed4f203

Implement bullet_launch_offset thing
author Thibaut Girka <thib@sitedethib.com>
date Tue, 06 Sep 2011 13:54:40 +0200
parents 2a03940deea3
children 4300a832f033
comparison
equal deleted inserted replaced
108:2a03940deea3 109:e93a7ed4f203
86 86
87 def fire(self): 87 def fire(self):
88 (type_, anim, sprite_idx_offset, bullets_per_shot, number_of_shots, 88 (type_, anim, sprite_idx_offset, bullets_per_shot, number_of_shots,
89 speed, speed2, launch_angle, angle, flags) = self.bullet_attributes 89 speed, speed2, launch_angle, angle, flags) = self.bullet_attributes
90 90
91 ox, oy = self.bullet_launch_offset
92 launch_pos = self.x + ox, self.y + oy
93
91 if speed2 < 0.3: 94 if speed2 < 0.3:
92 speed2 = 0.3 95 speed2 = 0.3
93 96
94 self.bullet_launch_timer = 0 97 self.bullet_launch_timer = 0
95 98
111 bullet_angle = launch_angle 114 bullet_angle = launch_angle
112 for bullet_nb in range(bullets_per_shot): 115 for bullet_nb in range(bullets_per_shot):
113 if type_ == 75: # 102.h@0x4138cf 116 if type_ == 75: # 102.h@0x4138cf
114 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
115 shot_speed = self._game_state.prng.rand_double() * (speed - speed2) + speed2 118 shot_speed = self._game_state.prng.rand_double() * (speed - speed2) + speed2
116 bullets.append(Bullet((self.x, self.y), 119 bullets.append(Bullet(launch_pos, anim, sprite_idx_offset,
117 anim, sprite_idx_offset,
118 bullet_angle, shot_speed, 120 bullet_angle, shot_speed,
119 self.extended_bullet_attributes, 121 self.extended_bullet_attributes,
120 flags, player, self._game_state)) 122 flags, player, self._game_state))
121 bullet_angle += angle 123 bullet_angle += angle
122 124