comparison pytouhou/game/player.pyx @ 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 6be9c99a3a24
children 3d3285918ba1
comparison
equal deleted inserted replaced
497:3da7395f39e3 498:c9c2fb873dbd
221 self.fire_time = 30 221 self.fire_time = 30
222 if self.fire_time > 0: 222 if self.fire_time > 0:
223 self.fire() 223 self.fire()
224 self.fire_time -= 1 224 self.fire_time -= 1
225 225
226 if keystate & 2 and self.bomb_time == 0: 226 if self.death_time == 0 or self.death_time < 6: #TODO: < or <=?
227 if keystate & 2 and self.bombs and self.bomb_time == 0:
227 self._game.set_player_bomb() 228 self._game.set_player_bomb()
228 self.bomb_time = 240 229 self.bomb_time = 240
230 self.bombs -= 1
231 self.bombs_used += 1
232 self.invulnerable_time = 240 #TODO: check the duration of bombs.
233 self.death_time = 0 # Deathbomb.
229 if self.bomb_time > 0: 234 if self.bomb_time > 0:
230 self.bomb_time -= 1 235 self.bomb_time -= 1
231 if self.bomb_time == 0: 236 if self.bomb_time == 0:
232 self._game.unset_player_bomb() 237 self._game.unset_player_bomb()
233 238
237 self.touchable = False 242 self.touchable = False
238 if self.power > 16: 243 if self.power > 16:
239 self.power -= 16 244 self.power -= 16
240 else: 245 else:
241 self.power = 0 246 self.power = 0
247 self.bombs = 3 #TODO: use the right default.
242 self._game.cancel_player_lasers() 248 self._game.cancel_player_lasers()
243 249
244 self.miss += 1 250 self.miss += 1
245 self.lives -= 1 251 self.lives -= 1
246 if self.lives < 0: 252 if self.lives < 0: