title: Sprite removal only when 'score' is met - Python
body: <p>I am relatively new to python and have started making a small space invaders style game, in which you play as an alien invading earth. The last level involves shooting at the earth to win the game. I have set it so the earth has a health of 500 and each time it is hit it decreases by 10. Once the health of the earth reaches 0, I wish to remove the image and play an explosion type sound along with a congratulations message, currently I have this code:</p>
  
  <pre><code>earth_list = pygame.sprite.Group()
  earthlife = 500
  
  ...
  
  class Earth(pygame.sprite.Sprite):
      def __init__(self, color):
          pygame.sprite.Sprite.__init__(self)
          self.image = pygame.image.load("Files/Images/Earth.png")
          self.rect = self.image.get_rect()
          self.rect.x = 400
          self.rect.y = 0
          self.earthlife = 500
  
  ...
  
  for i in range(1):
      earth = Earth(BLACK)
      block.rect.x = 400
      block.rect.y = 0
      earth_list.add(earth)
      all_sprites_list.add(earth)
  
  ...
  
  for bullet in bullet_list:
  
      earth_hit_list = pygame.sprite.spritecollide(bullet, earth_list, True)
  
      for earth in earth_hit_list:
          explosion.play()
          earthlife -= 10
  
          if earthlife == 0 and health &gt;=25:
              win.play()
              label = font.render("GAME COMPLETE", 1, (0,255,0))
              labelRect = label.get_rect()
              labelRect.center = (400, 250)
              labelC = font.render("PRESS ENTER TO RETURN TO MAIN MENU", 1, GREEN)
              labelCRect = labelC.get_rect()
              labelCRect.center = (250, 300)
              bullet_list.remove(bullet)
              all_sprites_list.remove(bullet)
              break
  
      if earthlife == 0:
          collision.stop()
          laser.stop()
          explosion.stop()
          earth_list.remove(earth)
          all_sprites_list.remove(earth)
          bullet_list.remove(bullet)
          all_sprites_list.remove(bullet)
          player_list.remove(player)
          all_sprites_list.remove(player)
  </code></pre>
  
  <p>However it doesnt seem to be functioning properly and the earth image gets removed on the first hit from my ships bullet, regardless of its health level. Here is the rest of my code in case it helps anyone:
  <a href="http://pastebin.com/p82JGs6q" rel="nofollow">http://pastebin.com/p82JGs6q</a></p>
  
  <p>Any help as to why this might not be working properly would be welcomed. Thank you :)</p>