From 9e34de19b4121673d4667c9b8e7211eb2ab82a48 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 7 May 2015 20:10:16 +0100 Subject: [PATCH] Added lives for when player gets shot. --- game.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/game.py b/game.py index a04dfa3..5bd42dd 100644 --- a/game.py +++ b/game.py @@ -123,6 +123,17 @@ def play(window): logging.info("Hit Target!") player.score += 1 + hit_list = pygame.sprite.spritecollide(bullet, player_group, True) + for player in hit_list: + if bullet.type != "TARGET" continue + bullet_group.remove(bullet) + logging.info("") + player.lives -= 1 + if player.lives <= 0: + return "LIVES" + + + if target_movement_timeout <=0: drop_targets = False