Added lives for when player gets shot.
This commit is contained in:
parent
e819e2e46d
commit
9e34de19b4
1 changed files with 11 additions and 0 deletions
11
game.py
11
game.py
|
@ -123,6 +123,17 @@ def play(window):
|
||||||
logging.info("Hit Target!")
|
logging.info("Hit Target!")
|
||||||
player.score += 1
|
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:
|
if target_movement_timeout <=0:
|
||||||
drop_targets = False
|
drop_targets = False
|
||||||
|
|
Reference in a new issue