Mercurial > fife-parpg
comparison demos/shooter/scripts/scene.py @ 475:afde89c1d50b
Switched to a damage system. Collisions with objects now cause 1 damage to the player.
When the boss switches weapons it now waits for the weapons firerate value in time to pass before it fires its first burst with the new weapon.
Fixed a little problem with the high score dialog as it operates in modal mode. It now waits for the entire frame to be complete before displaying the dialog box.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Wed, 21 Apr 2010 18:20:13 +0000 |
parents | 10aff123c62c |
children | 78a1eb57c074 |
comparison
equal
deleted
inserted
replaced
474:10aff123c62c | 475:afde89c1d50b |
---|---|
160 | 160 |
161 def unpause(self, time): | 161 def unpause(self, time): |
162 self._timemod += time - self._pausedtime | 162 self._timemod += time - self._pausedtime |
163 self._paused = False | 163 self._paused = False |
164 | 164 |
165 def playerHit(self): | 165 def playerHit(self, damage): |
166 self._player.applyHit(1) | 166 self._player.applyHit(damage) |
167 if self._player.lives <= -1: | 167 |
168 self._gameover = True | 168 def gameOver(self): |
169 self._world.gameOver() | 169 self._gameover = True |
170 self._world.gameOver() | |
170 | 171 |
171 def endLevel(self): | 172 def endLevel(self): |
172 self._world.endLevel() | 173 self._world.endLevel() |
173 | 174 |
174 def removeAllProjectiles(self): | 175 def removeAllProjectiles(self): |
274 if obj != self._player: | 275 if obj != self._player: |
275 if obj.running and obj.boundingbox.intersects(self._player.boundingbox): | 276 if obj.running and obj.boundingbox.intersects(self._player.boundingbox): |
276 #player touched an enemy. Destroy player and | 277 #player touched an enemy. Destroy player and |
277 #re-initialize scene | 278 #re-initialize scene |
278 if not self._player.invulnerable: | 279 if not self._player.invulnerable: |
279 self.playerHit() | 280 #collision damage of 1 |
280 if obj != self._boss: | 281 self.playerHit(1) |
281 obj.destroy() | 282 obj.applyHit(1) |
282 | 283 |
283 # self._world.renderBoundingBox(obj) | 284 # self._world.renderBoundingBox(obj) |
284 | 285 |
285 | 286 |
286 | 287 |
300 self._player.applyScore(o.scorevalue) | 301 self._player.applyScore(o.scorevalue) |
301 p.destroy() | 302 p.destroy() |
302 elif o == self._player: | 303 elif o == self._player: |
303 #player got hit by a projectile | 304 #player got hit by a projectile |
304 if not self._player.invulnerable: | 305 if not self._player.invulnerable: |
306 self.playerHit(p.damage) | |
305 p.destroy() | 307 p.destroy() |
306 self.playerHit() | |
307 | 308 |
308 # self._world.renderBoundingBox(p) | 309 # self._world.renderBoundingBox(p) |
309 | 310 |
310 | 311 |
311 #build a list of projectiles to remove (ttl expired) | 312 #build a list of projectiles to remove (ttl expired) |