Brak opisu

game_stats.py 582B

1234567891011121314151617181920
  1. class GameStats():
  2. """Track statistics for Alien Invasion."""
  3. def __init__(self, ai_settings):
  4. """Initialize statistics."""
  5. self.ai_settings = ai_settings
  6. self.reset_stats()
  7. # Start game in an inactive state.
  8. self.game_active = False
  9. # High score should never be reset.
  10. self.high_score = 0
  11. def reset_stats(self):
  12. """Initialize statistics that can change during the game."""
  13. self.ships_left = self.ai_settings.ship_limit
  14. self.score = 0
  15. self.level = 1