added lives
This commit is contained in:
parent
852071900e
commit
cce185db01
1 changed files with 4 additions and 2 deletions
4
game.py
4
game.py
|
@ -122,9 +122,11 @@ def play(window, options):
|
||||||
hit_list = pygame.sprite.spritecollide(bullet, target_group, False)
|
hit_list = pygame.sprite.spritecollide(bullet, target_group, False)
|
||||||
for target in hit_list:
|
for target in hit_list:
|
||||||
if bullet.type != "TARGET":
|
if bullet.type != "TARGET":
|
||||||
|
target.lives -= 1
|
||||||
|
if target.lives <= 0:
|
||||||
target_group.remove(target)
|
target_group.remove(target)
|
||||||
bullet_group.remove(bullet)
|
|
||||||
player.score += 1
|
player.score += 1
|
||||||
|
bullet_group.remove(bullet)
|
||||||
if target.lives <= 0 and target.type == "POWERUP":
|
if target.lives <= 0 and target.type == "POWERUP":
|
||||||
player.powerup = POWERUPS[randint(0,len(POWERUPS)-1)]
|
player.powerup = POWERUPS[randint(0,len(POWERUPS)-1)]
|
||||||
logging.info("Powerup set to {}".format(player.powerup))
|
logging.info("Powerup set to {}".format(player.powerup))
|
||||||
|
|
Reference in a new issue