Mercurial > touhou
comparison pytouhou/game/enemy.py @ 207:709f42eaa55e
Minor refactoring
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sat, 05 Nov 2011 20:19:15 +0100 |
parents | d348892ef012 |
children | 005ea47e11e0 |
comparison
equal
deleted
inserted
replaced
206:eca53abdfeab | 207:709f42eaa55e |
---|---|
101 | 101 |
102 self.bullet_launch_interval = int(value) | 102 self.bullet_launch_interval = int(value) |
103 self.bullet_launch_timer = int(value * start) | 103 self.bullet_launch_timer = int(value * start) |
104 | 104 |
105 | 105 |
106 def fire(self): | 106 def fire(self, offset=None, bullet_attributes=None, launch_pos=None): |
107 (type_, type_idx, sprite_idx_offset, bullets_per_shot, number_of_shots, | 107 (type_, type_idx, sprite_idx_offset, bullets_per_shot, number_of_shots, |
108 speed, speed2, launch_angle, angle, flags) = self.bullet_attributes | 108 speed, speed2, launch_angle, angle, flags) = bullet_attributes or self.bullet_attributes |
109 | 109 |
110 bullet_type = self._game.bullet_types[type_idx] | 110 bullet_type = self._game.bullet_types[type_idx] |
111 | 111 |
112 ox, oy = self.bullet_launch_offset | 112 if not launch_pos: |
113 launch_pos = self.x + ox, self.y + oy | 113 ox, oy = offset or self.bullet_launch_offset |
114 launch_pos = self.x + ox, self.y + oy | |
114 | 115 |
115 if speed2 < 0.3: | 116 if speed2 < 0.3: |
116 speed2 = 0.3 | 117 speed2 = 0.3 |
117 | 118 |
118 self.bullet_launch_timer = 0 | 119 self.bullet_launch_timer = 0 |