第六部分
This commit is contained in:
parent
bd294836b0
commit
b460e52ca5
|
@ -0,0 +1,19 @@
|
|||
class GameStats():
|
||||
"""Track statistics for Alien Invasion."""
|
||||
|
||||
def __init__(self, ai_settings):
|
||||
"""Initialize statistics."""
|
||||
self.ai_settings = ai_settings
|
||||
self.reset_stats()
|
||||
|
||||
# Start game in an inactive state.
|
||||
self.game_active = False
|
||||
|
||||
# High score should never be reset.
|
||||
self.high_score = 0
|
||||
|
||||
def reset_stats(self):
|
||||
"""Initialize statistics that can change during the game."""
|
||||
self.ships_left = self.ai_settings.ship_limit
|
||||
self.score = 0
|
||||
self.level = 1
|
Loading…
Reference in New Issue