You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
591 B
Python
21 lines
591 B
Python
from __future__ import annotations
|
|
from typing import TYPE_CHECKING
|
|
|
|
if TYPE_CHECKING:
|
|
from alien_invasion import AlienInvasion
|
|
|
|
class GameStats:
|
|
"""Track statistics for Alien Invasion."""
|
|
|
|
def __init__(self, ai_game: 'AlienInvasion') -> None:
|
|
"""Initialize statistics."""
|
|
self.settings = ai_game.settings
|
|
self.reset_stats()
|
|
self.high_score = 0
|
|
|
|
def reset_stats(self) -> None:
|
|
"""Initialize statistics that can change during the game."""
|
|
self.ships_left = self.settings.ship_limit
|
|
self.score = 0
|
|
self.level = 1
|