summaryrefslogtreecommitdiff
path: root/src/sliceitoff/stats/stats.py
blob: 22345d7e028d1bd799a2fff1f48f1048e2494d94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class Stats:
    score = 0
    level = 0
    bonus = 0
    lives = 0
    percent = 0
    bgcolor = (64,0,0,255)
    bordercolor = (0,0,0,255)
        
    @staticmethod
    def new_game():
        __class__.score = 0
        __class__.level = 1
        __class__.bonus = 20_000
        __class__.lives = 3
        __class__.percent = 100

    @staticmethod
    def level_up():
        __class__.score += __class__.level * 3_000
        __class__.score += __class__.level * __class__.bonus
        __class__.bonus = 20_000
        __class__.level += 1
    
    @staticmethod
    def lose_life():
        __class__.lives -= 1
        return not __class__.lives
    
    @staticmethod
    def update_bonus(dt):
        __class__.bonus = max(0, __class__.bonus - dt)