comparison pytouhou/games/eosd.py @ 232:8843e26f80c3

Hopefully implement “accelerating” bullets
author Thibaut Girka <thib@sitedethib.com>
date Sat, 31 Dec 2011 02:15:51 +0100
parents c417bb6c98bf
children 067f6d9c562b
comparison
equal deleted inserted replaced
231:c417bb6c98bf 232:8843e26f80c3
130 130
131 bullets = self._game.players_bullets 131 bullets = self._game.players_bullets
132 nb_bullets_max = self._game.nb_bullets_max 132 nb_bullets_max = self._game.nb_bullets_max
133 133
134 for shot in sht.shots[power]: 134 for shot in sht.shots[power]:
135 if shot.type in (2, 3): # TODO: Those shot types aren't handled yet 135 if shot.type == 3: # TODO: Lasers aren't implemented yet
136 continue 136 continue
137 137
138 if self.fire_time % shot.interval == shot.delay: 138 if self.fire_time % shot.interval != shot.delay:
139 if nb_bullets_max is not None and len(bullets) == nb_bullets_max: 139 continue
140 break
141 140
142 origin = self.orbs[shot.orb - 1] if shot.orb else self 141 if nb_bullets_max is not None and len(bullets) == nb_bullets_max:
143 x = origin.x + shot.pos[0] 142 break
144 y = origin.y + shot.pos[1]
145 143
146 #TODO: find a better way to do that. 144 origin = self.orbs[shot.orb - 1] if shot.orb else self
147 bullet_type = BulletType(self.anm_wrapper, shot.sprite % 256, 145 x = origin.x + shot.pos[0]
148 shot.sprite % 256 + 32, #TODO: find the real cancel anim 146 y = origin.y + shot.pos[1]
149 0, 0, 0, 0.) 147
148 #TODO: find a better way to do that.
149 bullet_type = BulletType(self.anm_wrapper, shot.sprite % 256,
150 shot.sprite % 256 + 32, #TODO: find the real cancel anim
151 0, 0, 0, 0.)
152 if shot.type == 2:
153 #TODO: check acceleration, check duration, check everything!
154 bullets.append(Bullet((x, y), bullet_type, 0,
155 shot.angle, shot.speed,
156 (-1, 0, 0, 0, 0.15, -pi/2., 0., 0.),
157 16, self, self._game, player_bullet=True,
158 damage=shot.damage, hitbox=shot.hitbox))
159 #TODO: types 1 and 4
160 else:
150 bullets.append(Bullet((x, y), bullet_type, 0, 161 bullets.append(Bullet((x, y), bullet_type, 0,
151 shot.angle, shot.speed, 162 shot.angle, shot.speed,
152 (0, 0, 0, 0, 0., 0., 0., 0.), 163 (0, 0, 0, 0, 0., 0., 0., 0.),
153 0, self, self._game, player_bullet=True, 164 0, self, self._game, player_bullet=True,
154 damage=shot.damage, hitbox=shot.hitbox)) 165 damage=shot.damage, hitbox=shot.hitbox))