summaryrefslogtreecommitdiff
path: root/src/sliceitoff/stats
diff options
context:
space:
mode:
authorViljami Ilola <+@hix.fi>2024-03-18 18:08:20 +0200
committerViljami Ilola <+@hix.fi>2024-03-18 18:08:20 +0200
commit78704848d4459907a456044615714b59d4593b2f (patch)
treed56c8422793ff1c5b6554146980760d264a6a0fe /src/sliceitoff/stats
parentb219c4f736e6b98dd247064b362997576954f0ff (diff)
stats, level_up, game_over
Diffstat (limited to 'src/sliceitoff/stats')
-rw-r--r--src/sliceitoff/stats/__init__.py1
-rw-r--r--src/sliceitoff/stats/stats.py31
2 files changed, 32 insertions, 0 deletions
diff --git a/src/sliceitoff/stats/__init__.py b/src/sliceitoff/stats/__init__.py
new file mode 100644
index 0000000..900594e
--- /dev/null
+++ b/src/sliceitoff/stats/__init__.py
@@ -0,0 +1 @@
+from .stats import Stats
diff --git a/src/sliceitoff/stats/stats.py b/src/sliceitoff/stats/stats.py
new file mode 100644
index 0000000..de7b0c1
--- /dev/null
+++ b/src/sliceitoff/stats/stats.py
@@ -0,0 +1,31 @@
+class Stats:
+ score = 0
+ level = 0
+ bonus = 0
+ lives = 0
+ percent = 0
+ bgcolor = (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 -= 3
+ return not __class__.lives
+
+ @staticmethod
+ def update_bonus(dt):
+ __class__.bonus = max(0, __class__.bonus - dt)