Mercurial > touhou
changeset 498:c9c2fb873dbd
Actually consume a bomb when using it, make the player invulnerable for a certain time, and implement deathbomb.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Mon, 14 Oct 2013 12:45:21 +0200 |
parents | 3da7395f39e3 |
children | 5426825c11a6 |
files | pytouhou/game/player.pyx |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/pytouhou/game/player.pyx +++ b/pytouhou/game/player.pyx @@ -223,9 +223,14 @@ cdef class Player(Element): self.fire() self.fire_time -= 1 - if keystate & 2 and self.bomb_time == 0: + if self.death_time == 0 or self.death_time < 6: #TODO: < or <=? + if keystate & 2 and self.bombs and self.bomb_time == 0: self._game.set_player_bomb() self.bomb_time = 240 + self.bombs -= 1 + self.bombs_used += 1 + self.invulnerable_time = 240 #TODO: check the duration of bombs. + self.death_time = 0 # Deathbomb. if self.bomb_time > 0: self.bomb_time -= 1 if self.bomb_time == 0: @@ -239,6 +244,7 @@ cdef class Player(Element): self.power -= 16 else: self.power = 0 + self.bombs = 3 #TODO: use the right default. self._game.cancel_player_lasers() self.miss += 1