comparison pytouhou/vm/eclrunner.py @ 256:507dfd6efe0c

Refactor pytouhou.game.bullet.
author Thibaut Girka <thib@sitedethib.com>
date Sun, 22 Jan 2012 21:41:18 +0100
parents 4b549894ef6b
children 3a86c4e070dc
comparison
equal deleted inserted replaced
255:a0d6b1915591 256:507dfd6efe0c
896 if function == 0: # Cirno 896 if function == 0: # Cirno
897 if arg == 0: 897 if arg == 0:
898 self._game.new_effect((self._enemy.x, self._enemy.y), 17) 898 self._game.new_effect((self._enemy.x, self._enemy.y), 17)
899 for bullet in self._game.bullets: 899 for bullet in self._game.bullets:
900 bullet.speed = bullet.angle = 0. 900 bullet.speed = bullet.angle = 0.
901 bullet.delta = (0., 0.) 901 bullet.dx, bullet.dy = 0., 0.
902 bullet.set_anim(sprite_idx_offset=15) #TODO: check 902 bullet.set_anim(sprite_idx_offset=15) #TODO: check
903 else: 903 else:
904 self._game.new_effect((self._enemy.x, self._enemy.y), 17) 904 self._game.new_effect((self._enemy.x, self._enemy.y), 17)
905 for bullet in self._game.bullets: 905 for bullet in self._game.bullets:
906 bullet.flags = 16 #TODO 906 bullet.flags = 16 #TODO: check
907 angle = pi + self._game.prng.rand_double() * 2. * pi 907 angle = pi + self._game.prng.rand_double() * 2. * pi
908 bullet.attributes[4:6] = [0.01, angle] #TODO 908 bullet.attributes[4:6] = [0.01, angle] #TODO: check
909 bullet.attributes[0] = -1 #TODO 909 bullet.attributes[0] = -1 #TODO: check
910 bullet.update = bullet.update_full #TODO
911 bullet.set_anim(sprite_idx_offset=15) #TODO: check 910 bullet.set_anim(sprite_idx_offset=15) #TODO: check
912 elif function == 1: # Cirno 911 elif function == 1: # Cirno
913 offset = (self._game.prng.rand_uint16() % arg - arg / 2, 912 offset = (self._game.prng.rand_uint16() % arg - arg / 2,
914 self._game.prng.rand_uint16() % arg - arg / 2) 913 self._game.prng.rand_uint16() % arg - arg / 2)
915 self._enemy.fire(offset=offset) 914 self._enemy.fire(offset=offset)