summaryrefslogtreecommitdiff
path: root/src/sliceitoff/status
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/status
parentb219c4f736e6b98dd247064b362997576954f0ff (diff)
stats, level_up, game_over
Diffstat (limited to 'src/sliceitoff/status')
-rw-r--r--src/sliceitoff/status/status.py28
1 files changed, 7 insertions, 21 deletions
diff --git a/src/sliceitoff/status/status.py b/src/sliceitoff/status/status.py
index f6517da..9b40955 100644
--- a/src/sliceitoff/status/status.py
+++ b/src/sliceitoff/status/status.py
@@ -3,6 +3,7 @@ import pygame
from display import Scaling
from images import Images, Fonts
+from stats import Stats
class LetterSprite(pygame.sprite.Sprite):
def __init__(self, image, pos):
@@ -23,37 +24,22 @@ class TextGroup(pygame.sprite.Group):
self.add(LetterSprite(image, image_pos))
class Status():
- def __init__(self, level = 1):
- self.score = 0
- self.bonus = 20_000
- self.lives = 3
- self.level = level
+ def __init__(self):
self.sprites = pygame.sprite.Group()
def update(self, dt):
""" Update sprites basis of dt. dt = milliseconds from last update """
- self.bonus = max(0, self.bonus - dt)
-
score_str = (
"{:02d}\x12 {:02d}\xfe {:02d}\x03 "
"{:02d}\x0e {:08d}\x0f").format(
- self.level,
- 99 if 100 == 100 else 99,
- self.lives,
- self.bonus // 1000,
- self.score)
+ Stats.level,
+ 99 if Stats.percent == 100 else int(Stats.percent),
+ Stats.lives,
+ Stats.bonus // 1000,
+ Stats.score)
self.sprites = TextGroup(
score_str,
(0, 282_000),
size = 16_000,
font = '8x8')
-
- def lose_life(self):
- """ Lose 1 life and return true if no lives left """
- self.lives -= 1
- return not self.lives
-
- def gain_life(self):
- """ Gain 1 life """
- self.lives += 1