Mercurial > touhou
comparison pytouhou/game/bullet.py @ 124:f06e96dbed4e
Fix a few things with special bullet flags
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sat, 10 Sep 2011 12:16:36 +0200 |
parents | d1c82d43bbf3 |
children | 81e05aed8db5 |
comparison
equal
deleted
inserted
replaced
123:d1c82d43bbf3 | 124:f06e96dbed4e |
---|---|
165 frame, count = self.attributes[0:2] | 165 frame, count = self.attributes[0:2] |
166 angle, speed = self.attributes[4:6] | 166 angle, speed = self.attributes[4:6] |
167 if self.frame % frame == 0: | 167 if self.frame % frame == 0: |
168 count = count - 1 | 168 count = count - 1 |
169 | 169 |
170 if self.flags & 64: | 170 if self.frame != 0: |
171 self.angle += angle | 171 self.speed = speed |
172 elif self.flags & 128: | 172 |
173 self.angle = atan2(self.player.y - y, self.player.x - x) + angle | 173 if self.flags & 64: |
174 elif self.flags & 256: | 174 self.angle += angle |
175 self.angle = angle | 175 elif self.flags & 128: |
176 | 176 self.angle = atan2(self.player.y - y, self.player.x - x) + angle |
177 dx, dy = cos(self.angle) * speed, sin(self.angle) * speed | 177 elif self.flags & 256: |
178 self.delta = dx, dy | 178 self.angle = angle |
179 sprite.angle = self.angle | 179 |
180 if sprite.automatic_orientation: | 180 dx, dy = cos(self.angle) * speed, sin(self.angle) * speed |
181 sprite._changed = True | 181 self.delta = dx, dy |
182 sprite.angle = self.angle | |
183 if sprite.automatic_orientation: | |
184 sprite._changed = True | |
182 | 185 |
183 if count > 0: | 186 if count > 0: |
184 self.speed_interpolator = Interpolator((speed,), self.frame, | 187 self.speed_interpolator = Interpolator((self.speed,), self.frame, |
185 (0.,), self.frame + frame - 1) | 188 (0.,), self.frame + frame - 1) |
186 else: | 189 else: |
187 self.flags &= ~448 | 190 self.flags &= ~448 |
188 self.speed = speed | |
189 | 191 |
190 self.attributes[1] = count | 192 self.attributes[1] = count |
191 #TODO: other flags | 193 #TODO: other flags |
192 elif not self.speed_interpolator and self._anmrunner is None: | 194 elif not self.speed_interpolator and self._anmrunner is None: |
193 self.update = self.update_simple | 195 self.update = self.update_simple |
194 | 196 |
195 if self.speed_interpolator: | 197 if self.speed_interpolator: |
196 self.speed_interpolator.update(self.frame) | 198 self.speed_interpolator.update(self.frame) |
197 self.speed, = self.speed_interpolator.values | 199 self.speed, = self.speed_interpolator.values |
200 dx, dy = cos(self.angle) * self.speed, sin(self.angle) * self.speed | |
201 self.delta = dx, dy | |
198 | 202 |
199 self.x, self.y = x + dx, y + dy | 203 self.x, self.y = x + dx, y + dy |
200 | 204 |
201 self.frame += 1 | 205 self.frame += 1 |
202 | 206 |