From cce185db01446c4f44254ec3ba77e0dd7cf0985b Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 19 May 2015 12:15:19 +0100 Subject: [PATCH] added lives --- game.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/game.py b/game.py index 42b68b1..7cc93f5 100644 --- a/game.py +++ b/game.py @@ -122,9 +122,11 @@ def play(window, options): hit_list = pygame.sprite.spritecollide(bullet, target_group, False) for target in hit_list: if bullet.type != "TARGET": - target_group.remove(target) + target.lives -= 1 + if target.lives <= 0: + target_group.remove(target) + player.score += 1 bullet_group.remove(bullet) - player.score += 1 if target.lives <= 0 and target.type == "POWERUP": player.powerup = POWERUPS[randint(0,len(POWERUPS)-1)] logging.info("Powerup set to {}".format(player.powerup))