Mercurial > touhou
comparison pytouhou/games/eosd.py @ 199:8ec34c56fed0
Implement orbs.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Mon, 31 Oct 2011 09:38:57 -0700 |
parents | e1bc8c4cbb1a |
children | 300661f2ae8a |
comparison
equal
deleted
inserted
replaced
198:13918723d1bc | 199:8ec34c56fed0 |
---|---|
16 from pytouhou.game.game import Game | 16 from pytouhou.game.game import Game |
17 from pytouhou.game.bullettype import BulletType | 17 from pytouhou.game.bullettype import BulletType |
18 from pytouhou.game.itemtype import ItemType | 18 from pytouhou.game.itemtype import ItemType |
19 from pytouhou.game.player import Player | 19 from pytouhou.game.player import Player |
20 from pytouhou.game.bullet import Bullet | 20 from pytouhou.game.bullet import Bullet |
21 from pytouhou.game.orb import Orb | |
21 | 22 |
22 from math import pi | 23 from math import pi |
23 | 24 |
24 | 25 |
25 class EoSDGame(Game): | 26 class EoSDGame(Game): |
70 bullets_per_shot = 2 | 71 bullets_per_shot = 2 |
71 elif self.state.power < 96: | 72 elif self.state.power < 96: |
72 bullets_per_shot = 3 | 73 bullets_per_shot = 3 |
73 elif self.state.power < 128: | 74 elif self.state.power < 128: |
74 bullets_per_shot = 4 | 75 bullets_per_shot = 4 |
75 elif self.state.power >= 128: | 76 else: |
76 bullets_per_shot = 5 | 77 bullets_per_shot = 5 |
77 | 78 |
78 bullets = self._game.players_bullets | 79 bullets = self._game.players_bullets |
79 nb_bullets_max = self._game.nb_bullets_max | 80 nb_bullets_max = self._game.nb_bullets_max |
80 | 81 |
87 bullet_angle, self.bullet_speed, | 88 bullet_angle, self.bullet_speed, |
88 (0, 0, 0, 0, 0., 0., 0., 0.), | 89 (0, 0, 0, 0, 0., 0., 0., 0.), |
89 0, self, self._game, player_bullet=True)) | 90 0, self, self._game, player_bullet=True)) |
90 bullet_angle += self.bullet_angle | 91 bullet_angle += self.bullet_angle |
91 | 92 |
93 for orb in self.orbs: | |
94 orb.fire(orb) | |
95 | |
92 | 96 |
93 class ReimuA(Reimu): | 97 class ReimuA(Reimu): |
94 def __init__(self, state, game, resource_loader): | 98 def __init__(self, state, game, resource_loader): |
95 Reimu.__init__(self, state, game, resource_loader) | 99 Reimu.__init__(self, state, game, resource_loader) |
96 | 100 |
97 self.bulletA_type = BulletType(self.anm_wrapper, 65, 97, 0, 0, 0, hitbox_size=4, damage=48) #TODO: verify the hitbox and damages. | 101 self.bulletA_type = BulletType(self.anm_wrapper, 65, 97, 0, 0, 0, hitbox_size=4, damage=14) #TODO: verify the hitbox. |
98 self.bulletA_speed = 12. | 102 self.bulletA_speed = 12. |
99 | 103 |
100 | 104 |
101 def fire(self): | 105 def fire(self): |
102 Reimu.fire(self) | 106 Reimu.fire(self) |
110 | 114 |
111 class ReimuB(Reimu): | 115 class ReimuB(Reimu): |
112 def __init__(self, state, game, resource_loader): | 116 def __init__(self, state, game, resource_loader): |
113 Reimu.__init__(self, state, game, resource_loader) | 117 Reimu.__init__(self, state, game, resource_loader) |
114 | 118 |
115 self.bulletB_type = BulletType(self.anm_wrapper, 66, 98, 0, 0, 0, hitbox_size=4, damage=48) #TODO: verify the hitbox and damages. | 119 self.bulletB_type = BulletType(self.anm_wrapper, 66, 98, 0, 0, 0, hitbox_size=4, damage=12) #TODO: verify the hitbox. |
116 self.bulletB_speed = 22. | 120 self.bulletB_speed = 22. |
117 | 121 |
118 | 122 self.orbs = [Orb(self.anm_wrapper, 128, self.state, self.orb_fire), |
119 def fire_spine(self, offset_x): | 123 Orb(self.anm_wrapper, 129, self.state, self.orb_fire)] |
124 self.orbs[0].dx = -24 | |
125 self.orbs[1].dx = 24 | |
126 | |
127 | |
128 def fire_spine(self, orb, offset_x): | |
120 bullets = self._game.players_bullets | 129 bullets = self._game.players_bullets |
121 nb_bullets_max = self._game.nb_bullets_max | 130 nb_bullets_max = self._game.nb_bullets_max |
122 | 131 |
123 if nb_bullets_max is not None and len(bullets) == nb_bullets_max: | 132 if nb_bullets_max is not None and len(bullets) == nb_bullets_max: |
124 return | 133 return |
125 | 134 |
126 bullets.append(Bullet((self.x + offset_x, self.y), self.bulletB_type, 0, | 135 bullets.append(Bullet((orb.x + offset_x, orb.y), self.bulletB_type, 0, |
127 self.bullet_launch_angle, self.bulletB_speed, | 136 self.bullet_launch_angle, self.bulletB_speed, |
128 (0, 0, 0, 0, 0., 0., 0., 0.), | 137 (0, 0, 0, 0, 0., 0., 0., 0.), |
129 0, self, self._game, player_bullet=True)) | 138 0, self, self._game, player_bullet=True)) |
130 | 139 |
131 | 140 def orb_fire(self, orb): |
132 def fire(self): | |
133 Reimu.fire(self) | |
134 | |
135 if self.state.power < 8: | 141 if self.state.power < 8: |
136 return | 142 return |
137 | 143 |
138 elif self.state.power < 16: | 144 elif self.state.power < 16: |
139 if self.fire_time % 15 == 0: | 145 if self.fire_time % 15 == 0: |
140 for offset in (-24, 24): | 146 self.fire_spine(orb, 0) |
141 self.fire_spine(offset) | |
142 | 147 |
143 elif self.state.power < 32: | 148 elif self.state.power < 32: |
144 if self.fire_time % 10 == 0: | 149 if self.fire_time % 10 == 0: |
145 for offset in (-24, 24): | 150 self.fire_spine(orb, 0) |
146 self.fire_spine(offset) | |
147 | 151 |
148 elif self.state.power < 48: | 152 elif self.state.power < 48: |
149 if self.fire_time % 8 == 0: | 153 if self.fire_time % 8 == 0: |
150 for offset in (-24, 24): | 154 self.fire_spine(orb, 0) |
151 self.fire_spine(offset) | |
152 | 155 |
153 elif self.state.power < 96: | 156 elif self.state.power < 96: |
157 if self.fire_time % 8 == 0: | |
158 self.fire_spine(orb, -8) | |
154 if self.fire_time % 5 == 0: | 159 if self.fire_time % 5 == 0: |
155 for offset in (-16, 32): | 160 self.fire_spine(orb, 8) |
156 self.fire_spine(offset) | |
157 if self.fire_time % 8 == 0: | |
158 for offset in (-32, 16): | |
159 self.fire_spine(offset) | |
160 | 161 |
161 elif self.state.power < 128: | 162 elif self.state.power < 128: |
163 if self.fire_time % 5 == 0: | |
164 self.fire_spine(orb, -12) | |
165 if self.fire_time % 10 == 0: | |
166 self.fire_spine(orb, 0) | |
162 if self.fire_time % 3 == 0: | 167 if self.fire_time % 3 == 0: |
163 for offset in (-12, 36): | 168 self.fire_spine(orb, 12) |
164 self.fire_spine(offset) | 169 |
170 else: | |
171 if self.fire_time % 3 == 0: | |
172 self.fire_spine(orb, -12) | |
173 self.fire_spine(orb, 12) | |
165 if self.fire_time % 5 == 0: | 174 if self.fire_time % 5 == 0: |
166 for offset in (-36, 12): | 175 self.fire_spine(orb, 0) |
167 self.fire_spine(offset) | 176 |
168 if self.fire_time % 10 == 0: | 177 |
169 for offset in (-24, 24): | 178 def update(self, keystate): |
170 self.fire_spine(offset) | 179 Player.update(self, keystate) |
171 | |
172 else: | |
173 if self.fire_time % 3 == 0: | |
174 for offset in (-36, -12, 12, 36): | |
175 self.fire_spine(offset) | |
176 if self.fire_time % 5 == 0: | |
177 for offset in (-24, 24): | |
178 self.fire_spine(offset) | |
179 | 180 |
180 | 181 |
181 class Marisa(Player): | 182 class Marisa(Player): |
182 def __init__(self, state, game, resource_loader): | 183 def __init__(self, state, game, resource_loader): |
183 anm_wrapper = resource_loader.get_anm_wrapper(('player01.anm',)) | 184 anm_wrapper = resource_loader.get_anm_wrapper(('player01.anm',)) |
192 bullets_per_shot = 1 | 193 bullets_per_shot = 1 |
193 elif self.state.power < 96: | 194 elif self.state.power < 96: |
194 bullets_per_shot = 2 | 195 bullets_per_shot = 2 |
195 elif self.state.power < 128: | 196 elif self.state.power < 128: |
196 bullets_per_shot = 3 | 197 bullets_per_shot = 3 |
197 elif self.state.power >= 128: | 198 else: |
198 bullets_per_shot = 5 | 199 bullets_per_shot = 5 |
199 | 200 |
200 bullets = self._game.players_bullets | 201 bullets = self._game.players_bullets |
201 nb_bullets_max = self._game.nb_bullets_max | 202 nb_bullets_max = self._game.nb_bullets_max |
202 | 203 |
215 class MarisaA(Marisa): | 216 class MarisaA(Marisa): |
216 def __init__(self, state, game, resource_loader): | 217 def __init__(self, state, game, resource_loader): |
217 Marisa.__init__(self, state, game, resource_loader) | 218 Marisa.__init__(self, state, game, resource_loader) |
218 | 219 |
219 #TODO: verify the hitbox and damages. | 220 #TODO: verify the hitbox and damages. |
220 self.bulletA_types = [BulletType(self.anm_wrapper, 65, 0, 0, 0, 0, hitbox_size=4, damage=48), | 221 self.bulletA_types = [BulletType(self.anm_wrapper, 65, 0, 0, 0, 0, hitbox_size=4, damage=40), |
221 BulletType(self.anm_wrapper, 66, 0, 0, 0, 0, hitbox_size=4, damage=48), | 222 BulletType(self.anm_wrapper, 66, 0, 0, 0, 0, hitbox_size=4), |
222 BulletType(self.anm_wrapper, 67, 0, 0, 0, 0, hitbox_size=4, damage=48), | 223 BulletType(self.anm_wrapper, 67, 0, 0, 0, 0, hitbox_size=4), |
223 BulletType(self.anm_wrapper, 68, 0, 0, 0, 0, hitbox_size=4, damage=48)] | 224 BulletType(self.anm_wrapper, 68, 0, 0, 0, 0, hitbox_size=4)] |
224 self.bulletA_speed_interpolator = None | 225 self.bulletA_speed_interpolator = None |
225 | 226 |
226 | 227 |
227 def fire(self): | 228 def fire(self): |
228 Marisa.fire(self) | 229 Marisa.fire(self) |
236 | 237 |
237 class MarisaB(Marisa): | 238 class MarisaB(Marisa): |
238 def __init__(self, state, game, resource_loader): | 239 def __init__(self, state, game, resource_loader): |
239 Marisa.__init__(self, state, game, resource_loader) | 240 Marisa.__init__(self, state, game, resource_loader) |
240 | 241 |
241 self.laser_type = None | 242 #TODO: power damages period |
243 # 8 240 120 | |
244 # 16 390 170 | |
245 # 32 480 ??? | |
246 # 48 510 ??? | |
247 # 64 760 ??? | |
248 # 80 840 ??? | |
249 # 96 1150 270 | |
250 # 128 1740 330 | |
251 # The duration of the laser is period - 42. | |
252 # The damages are given for one laser shot on one enemy for its entire duration. | |
242 | 253 |
243 | 254 |
244 def fire(self): | 255 def fire(self): |
245 Marisa.fire(self) | 256 Marisa.fire(self) |
246 | 257 |