diff options
Diffstat (limited to 'src/sliceitoff/stats/stats.py')
-rw-r--r-- | src/sliceitoff/stats/stats.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/sliceitoff/stats/stats.py b/src/sliceitoff/stats/stats.py index 2d63953..87c4c5f 100644 --- a/src/sliceitoff/stats/stats.py +++ b/src/sliceitoff/stats/stats.py @@ -1,5 +1,6 @@ +""" stats.stats """ class Stats: - + """ score, level, enemy count etc stats during the game """ def __init__(self): self.score = 0 self.level = 1 @@ -8,26 +9,28 @@ class Stats: self.enemies = 3 self.percent = 100 self.field_count = 1 - self.bgcolor = (64,0,0,255) - self.bordercolor = (0,0,0,255) - + def level_up(self): + """ task on beginning of level. new bonus, enemy count... """ self.score += self.calc_bonus()[0] self.bonus = 20_000 self.percent = 100 self.field_count = 1 self.level += 1 self.enemies = 3 + (self.level - 1) * 2 - + def lose_life(self): + """ lives left after losing life """ self.lives -= 1 return not self.lives - + def add_score(self, score_to_add): + """ adding score never goes negative """ self.score += score_to_add self.score = max(0, self.score) def calc_bonus(self): + """ calculates bonus and returns components """ level = self.level * 3_000 life = self.lives * 1_000 time = self.level * self.bonus @@ -37,4 +40,5 @@ class Stats: return total, level, life, time, area, herd def update_bonus(self, dt): + """ bonus countdown. never goes negative """ self.bonus = max(0, self.bonus - dt) |