Mercurial > touhou
comparison pytouhou/game/player.pyx @ 527:db28538cd399
Use Sprite C arrays instead of their tuple representation where it makes sense.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Wed, 18 Dec 2013 18:19:08 +0100 |
parents | 292fea5c584e |
children | e35bef07290d |
comparison
equal
deleted
inserted
replaced
526:0b2a92a25245 | 527:db28538cd399 |
---|---|
206 if self.invulnerable_time > 0: | 206 if self.invulnerable_time > 0: |
207 self.invulnerable_time -= 1 | 207 self.invulnerable_time -= 1 |
208 | 208 |
209 m = self.invulnerable_time % 8 | 209 m = self.invulnerable_time % 8 |
210 if m == 7 or self.invulnerable_time == 0: | 210 if m == 7 or self.invulnerable_time == 0: |
211 self.sprite.color = (255, 255, 255) | 211 for i in xrange(3): |
212 self.sprite._color[i] = 255 | |
212 self.sprite.changed = True | 213 self.sprite.changed = True |
213 elif m == 1: | 214 elif m == 1: |
214 self.sprite.color = (64, 64, 64) | 215 for i in xrange(3): |
216 self.sprite._color[i] = 64 | |
215 self.sprite.changed = True | 217 self.sprite.changed = True |
216 | 218 |
217 if keystate & 1 and self.fire_time == 0: | 219 if keystate & 1 and self.fire_time == 0: |
218 self.fire_time = 30 | 220 self.fire_time = 30 |
219 if self.fire_time > 0: | 221 if self.fire_time > 0: |
278 self._game.prng.rand_double() * 192 - 64)) | 280 self._game.prng.rand_double() * 192 - 64)) |
279 | 281 |
280 elif time == 7: | 282 elif time == 7: |
281 self.sprite.mirrored = False | 283 self.sprite.mirrored = False |
282 self.sprite.blendfunc = 0 | 284 self.sprite.blendfunc = 0 |
283 self.sprite.rescale = 0.75, 1.5 | 285 self.sprite._rescale[:] = [0.75, 1.5] |
284 self.sprite.fade(26, 96) | 286 self.sprite.fade(26, 96) |
285 self.sprite.scale_in(26, 0., 2.5) | 287 self.sprite.scale_in(26, 0., 2.5) |
286 | 288 |
287 #TODO: the next two branches could be happening at the same frame. | 289 #TODO: the next two branches could be happening at the same frame. |
288 elif time == 31: | 290 elif time == 31: |
293 self.y = float(self._game.width) #TODO | 295 self.y = float(self._game.width) #TODO |
294 self.direction = 0 | 296 self.direction = 0 |
295 | 297 |
296 self.sprite = Sprite() | 298 self.sprite = Sprite() |
297 self.anmrunner = ANMRunner(self.anm, 0, self.sprite) | 299 self.anmrunner = ANMRunner(self.anm, 0, self.sprite) |
298 self.sprite.alpha = 128 | 300 self.sprite._color[3] = 128 |
299 self.sprite.rescale = 0., 2.5 | 301 self.sprite._rescale[:] = [0., 2.5] |
300 self.sprite.fade(30, 255) | 302 self.sprite.fade(30, 255) |
301 self.sprite.blendfunc = 1 | 303 self.sprite.blendfunc = 1 |
302 self.sprite.scale_in(30, 1., 1.) | 304 self.sprite.scale_in(30, 1., 1.) |
303 | 305 |
304 elif time == 61: # respawned | 306 elif time == 61: # respawned |