Mercurial > touhou
comparison pytouhou/games/eosd.py @ 220:0595315d3880
Fix SHT handling; change a few things to be closer to ZUN’s mind; and first stub of PCB support.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 18 Dec 2011 14:14:32 +0100 |
parents | a842ddd471fd |
children | 5afc75f71fed |
comparison
equal
deleted
inserted
replaced
219:091301805cce | 220:0595315d3880 |
---|---|
20 from pytouhou.game.player import Player | 20 from pytouhou.game.player import Player |
21 from pytouhou.game.bullet import Bullet | 21 from pytouhou.game.bullet import Bullet |
22 from pytouhou.game.orb import Orb | 22 from pytouhou.game.orb import Orb |
23 | 23 |
24 from math import pi | 24 from math import pi |
25 | |
26 | |
27 SQ2 = 2. ** 0.5 / 2. | |
25 | 28 |
26 | 29 |
27 class EoSDGame(Game): | 30 class EoSDGame(Game): |
28 def __init__(self, resource_loader, player_states, stage, rank, difficulty, **kwargs): | 31 def __init__(self, resource_loader, player_states, stage, rank, difficulty, **kwargs): |
29 etama3 = resource_loader.get_anm_wrapper(('etama3.anm',)) | 32 etama3 = resource_loader.get_anm_wrapper(('etama3.anm',)) |
56 bullet_types, item_types, nb_bullets_max=640, **kwargs) | 59 bullet_types, item_types, nb_bullets_max=640, **kwargs) |
57 | 60 |
58 | 61 |
59 | 62 |
60 class EoSDPlayer(Player): | 63 class EoSDPlayer(Player): |
61 def __init__(self, state, game, anm_wrapper, speed=4., hitbox_size=2.5, graze_hitbox_size=42.): | 64 def __init__(self, state, game, anm_wrapper, speeds=None, hitbox_size=2.5, graze_hitbox_size=42.): |
62 Player.__init__(self, state, game, anm_wrapper, speed=speed) | 65 Player.__init__(self, state, game, anm_wrapper, speeds=speeds) |
63 | 66 |
64 self.orbs = [Orb(self.anm_wrapper, 128, self.state, self.orb_fire), | 67 self.orbs = [Orb(self.anm_wrapper, 128, self.state, self.orb_fire), |
65 Orb(self.anm_wrapper, 129, self.state, self.orb_fire)] | 68 Orb(self.anm_wrapper, 129, self.state, self.orb_fire)] |
66 | 69 |
67 self.orbs[0].offset_x = -24 | 70 self.orbs[0].offset_x = -24 |
120 class Reimu(EoSDPlayer): | 123 class Reimu(EoSDPlayer): |
121 def __init__(self, state, game, resource_loader): | 124 def __init__(self, state, game, resource_loader): |
122 anm_wrapper = resource_loader.get_anm_wrapper(('player00.anm',)) | 125 anm_wrapper = resource_loader.get_anm_wrapper(('player00.anm',)) |
123 self.bullet_angle = pi/30 #TODO: check | 126 self.bullet_angle = pi/30 #TODO: check |
124 | 127 |
125 EoSDPlayer.__init__(self, state, game, anm_wrapper, speed=4.) | 128 EoSDPlayer.__init__(self, state, game, anm_wrapper, speeds=(4., 4. * SQ2, 2., 2. * SQ2)) |
126 | 129 |
127 | 130 |
128 def fire(self): | 131 def fire(self): |
129 if self.fire_time % self.bullet_launch_interval == 0: | 132 if self.fire_time % self.bullet_launch_interval == 0: |
130 if self.state.power < 16: | 133 if self.state.power < 16: |
147 break | 150 break |
148 | 151 |
149 bullets.append(Bullet((self.x, self.y), self.bullet_type, 0, | 152 bullets.append(Bullet((self.x, self.y), self.bullet_type, 0, |
150 bullet_angle, self.bullet_speed, | 153 bullet_angle, self.bullet_speed, |
151 (0, 0, 0, 0, 0., 0., 0., 0.), | 154 (0, 0, 0, 0, 0., 0., 0., 0.), |
152 0, self, self._game, player_bullet=True)) | 155 0, self, self._game, damage=48, player_bullet=True)) |
153 bullet_angle += self.bullet_angle | 156 bullet_angle += self.bullet_angle |
154 | 157 |
155 for orb in self.orbs: | 158 for orb in self.orbs: |
156 orb.fire(orb) | 159 orb.fire(orb) |
157 | 160 |
159 | 162 |
160 class ReimuA(Reimu): | 163 class ReimuA(Reimu): |
161 def __init__(self, state, game, resource_loader): | 164 def __init__(self, state, game, resource_loader): |
162 Reimu.__init__(self, state, game, resource_loader) | 165 Reimu.__init__(self, state, game, resource_loader) |
163 | 166 |
164 self.bulletA_type = BulletType(self.anm_wrapper, 65, 97, 0, 0, 0, hitbox_size=4, damage=14) #TODO: verify the hitbox. | 167 self.bulletA_type = BulletType(self.anm_wrapper, 65, 97, 0, 0, 0, hitbox_size=4) #TODO: verify the hitbox, damage is 14. |
165 self.bulletA_speed = 12. | 168 self.bulletA_speed = 12. |
166 | 169 |
167 | 170 |
168 def fire(self): | 171 def fire(self): |
169 Reimu.fire(self) | 172 Reimu.fire(self) |
178 | 181 |
179 class ReimuB(Reimu): | 182 class ReimuB(Reimu): |
180 def __init__(self, state, game, resource_loader): | 183 def __init__(self, state, game, resource_loader): |
181 Reimu.__init__(self, state, game, resource_loader) | 184 Reimu.__init__(self, state, game, resource_loader) |
182 | 185 |
183 self.bulletB_type = BulletType(self.anm_wrapper, 66, 98, 0, 0, 0, hitbox_size=4, damage=12) #TODO: verify the hitbox. | 186 self.bulletB_type = BulletType(self.anm_wrapper, 66, 98, 0, 0, 0, hitbox_size=4) #TODO: verify the hitbox. |
184 self.bulletB_speed = 22. | 187 self.bulletB_speed = 22. |
185 | 188 |
186 | 189 |
187 def fire_spine(self, orb, offset_x): | 190 def fire_spine(self, orb, offset_x): |
188 bullets = self._game.players_bullets | 191 bullets = self._game.players_bullets |
192 return | 195 return |
193 | 196 |
194 bullets.append(Bullet((orb.x + offset_x, orb.y), self.bulletB_type, 0, | 197 bullets.append(Bullet((orb.x + offset_x, orb.y), self.bulletB_type, 0, |
195 self.bullet_launch_angle, self.bulletB_speed, | 198 self.bullet_launch_angle, self.bulletB_speed, |
196 (0, 0, 0, 0, 0., 0., 0., 0.), | 199 (0, 0, 0, 0, 0., 0., 0., 0.), |
197 0, self, self._game, player_bullet=True)) | 200 0, self, self._game, damage=12, player_bullet=True)) |
198 | 201 |
199 def orb_fire(self, orb): | 202 def orb_fire(self, orb): |
200 if self.state.power < 8: | 203 if self.state.power < 8: |
201 return | 204 return |
202 | 205 |
238 class Marisa(EoSDPlayer): | 241 class Marisa(EoSDPlayer): |
239 def __init__(self, state, game, resource_loader): | 242 def __init__(self, state, game, resource_loader): |
240 anm_wrapper = resource_loader.get_anm_wrapper(('player01.anm',)) | 243 anm_wrapper = resource_loader.get_anm_wrapper(('player01.anm',)) |
241 self.bullet_angle = pi/40 #TODO: check | 244 self.bullet_angle = pi/40 #TODO: check |
242 | 245 |
243 EoSDPlayer.__init__(self, state, game, anm_wrapper, speed=5.) | 246 EoSDPlayer.__init__(self, state, game, anm_wrapper, speeds=(5., 5. * SQ2, 2.5, 2.5 * SQ2)) |
244 | 247 |
245 | 248 |
246 def fire(self): | 249 def fire(self): |
247 if self.fire_time % self.bullet_launch_interval == 0: | 250 if self.fire_time % self.bullet_launch_interval == 0: |
248 if self.state.power < 32: | 251 if self.state.power < 32: |
263 break | 266 break |
264 | 267 |
265 bullets.append(Bullet((self.x, self.y), self.bullet_type, 0, | 268 bullets.append(Bullet((self.x, self.y), self.bullet_type, 0, |
266 bullet_angle, self.bullet_speed, | 269 bullet_angle, self.bullet_speed, |
267 (0, 0, 0, 0, 0., 0., 0., 0.), | 270 (0, 0, 0, 0, 0., 0., 0., 0.), |
268 0, self, self._game, player_bullet=True)) | 271 0, self, self._game, damage=48, player_bullet=True)) |
269 bullet_angle += self.bullet_angle | 272 bullet_angle += self.bullet_angle |
270 | 273 |
271 | 274 |
272 | 275 |
273 class MarisaA(Marisa): | 276 class MarisaA(Marisa): |
274 def __init__(self, state, game, resource_loader): | 277 def __init__(self, state, game, resource_loader): |
275 Marisa.__init__(self, state, game, resource_loader) | 278 Marisa.__init__(self, state, game, resource_loader) |
276 | 279 |
277 #TODO: verify the hitbox and damages. | 280 #TODO: verify the hitbox and damages. |
278 self.bulletA_types = [BulletType(self.anm_wrapper, 65, 0, 0, 0, 0, hitbox_size=4, damage=40), | 281 self.bulletA_types = [BulletType(self.anm_wrapper, 65, 0, 0, 0, 0, hitbox_size=4), # damage is 40. |
279 BulletType(self.anm_wrapper, 66, 0, 0, 0, 0, hitbox_size=4), | 282 BulletType(self.anm_wrapper, 66, 0, 0, 0, 0, hitbox_size=4), |
280 BulletType(self.anm_wrapper, 67, 0, 0, 0, 0, hitbox_size=4), | 283 BulletType(self.anm_wrapper, 67, 0, 0, 0, 0, hitbox_size=4), |
281 BulletType(self.anm_wrapper, 68, 0, 0, 0, 0, hitbox_size=4)] | 284 BulletType(self.anm_wrapper, 68, 0, 0, 0, 0, hitbox_size=4)] |
282 self.bulletA_speed_interpolator = None | 285 self.bulletA_speed_interpolator = None |
283 | 286 |