Mercurial > touhou
comparison pytouhou/game/enemy.py @ 311:550ec10cccbc
Fix angle between salves of circle-distributed bullets.
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Wed, 14 Mar 2012 19:02:45 +0100 |
parents | 14c9aca8e274 |
children | f0be7ea62330 |
comparison
equal
deleted
inserted
replaced
310:81c5b0b51093 | 311:550ec10cccbc |
---|---|
135 | 135 |
136 player = self.select_player() | 136 player = self.select_player() |
137 | 137 |
138 if type_ in (67, 69, 71): | 138 if type_ in (67, 69, 71): |
139 launch_angle += self.get_player_angle(player, launch_pos) | 139 launch_angle += self.get_player_angle(player, launch_pos) |
140 if type_ in (69, 70, 71, 74): | |
141 angle = 2. * pi / bullets_per_shot | |
142 if type_ == 71 and bullets_per_shot % 2 or type_ in (69, 70) and not bullets_per_shot % 2: | 140 if type_ == 71 and bullets_per_shot % 2 or type_ in (69, 70) and not bullets_per_shot % 2: |
143 launch_angle += pi / bullets_per_shot | 141 launch_angle += pi / bullets_per_shot |
144 if type_ != 75: | 142 if type_ != 75: |
145 launch_angle -= angle * (bullets_per_shot - 1) / 2. | 143 launch_angle -= angle * (bullets_per_shot - 1) / 2. |
146 | 144 |
148 nb_bullets_max = self._game.nb_bullets_max | 146 nb_bullets_max = self._game.nb_bullets_max |
149 | 147 |
150 for shot_nb in range(number_of_shots): | 148 for shot_nb in range(number_of_shots): |
151 shot_speed = speed if shot_nb == 0 else speed + (speed2 - speed) * float(shot_nb) / float(number_of_shots) | 149 shot_speed = speed if shot_nb == 0 else speed + (speed2 - speed) * float(shot_nb) / float(number_of_shots) |
152 bullet_angle = launch_angle | 150 bullet_angle = launch_angle |
151 if type_ in (69, 70, 71, 74): | |
152 launch_angle += angle | |
153 for bullet_nb in range(bullets_per_shot): | 153 for bullet_nb in range(bullets_per_shot): |
154 if nb_bullets_max is not None and len(bullets) == nb_bullets_max: | 154 if nb_bullets_max is not None and len(bullets) == nb_bullets_max: |
155 break | 155 break |
156 | 156 |
157 if type_ == 75: # 102h.exe@0x4138cf | 157 if type_ == 75: # 102h.exe@0x4138cf |
160 shot_speed = self._game.prng.rand_double() * (speed - speed2) + speed2 | 160 shot_speed = self._game.prng.rand_double() * (speed - speed2) + speed2 |
161 bullets.append(Bullet(launch_pos, bullet_type, sprite_idx_offset, | 161 bullets.append(Bullet(launch_pos, bullet_type, sprite_idx_offset, |
162 bullet_angle, shot_speed, | 162 bullet_angle, shot_speed, |
163 self.extended_bullet_attributes, | 163 self.extended_bullet_attributes, |
164 flags, player, self._game)) | 164 flags, player, self._game)) |
165 bullet_angle += angle | 165 |
166 if type_ in (69, 70, 71, 74): | |
167 bullet_angle += 2. * pi / bullets_per_shot | |
168 else: | |
169 bullet_angle += angle | |
166 | 170 |
167 | 171 |
168 def new_laser(self, variant, laser_type, sprite_idx_offset, angle, speed, | 172 def new_laser(self, variant, laser_type, sprite_idx_offset, angle, speed, |
169 start_offset, end_offset, max_length, width, | 173 start_offset, end_offset, max_length, width, |
170 start_duration, duration, end_duration, | 174 start_duration, duration, end_duration, |