Mercurial > fife-parpg
diff 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 |
line wrap: on
line diff
--- a/demos/shooter/scripts/scene.py Wed Apr 21 16:49:59 2010 +0000 +++ b/demos/shooter/scripts/scene.py Wed Apr 21 18:20:13 2010 +0000 @@ -162,11 +162,12 @@ self._timemod += time - self._pausedtime self._paused = False - def playerHit(self): - self._player.applyHit(1) - if self._player.lives <= -1: - self._gameover = True - self._world.gameOver() + def playerHit(self, damage): + self._player.applyHit(damage) + + def gameOver(self): + self._gameover = True + self._world.gameOver() def endLevel(self): self._world.endLevel() @@ -276,9 +277,9 @@ #player touched an enemy. Destroy player and #re-initialize scene if not self._player.invulnerable: - self.playerHit() - if obj != self._boss: - obj.destroy() + #collision damage of 1 + self.playerHit(1) + obj.applyHit(1) # self._world.renderBoundingBox(obj) @@ -302,8 +303,8 @@ elif o == self._player: #player got hit by a projectile if not self._player.invulnerable: + self.playerHit(p.damage) p.destroy() - self.playerHit() # self._world.renderBoundingBox(p)