summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorViljami Ilola <+@hix.fi>2024-03-18 13:22:17 +0200
committerViljami Ilola <+@hix.fi>2024-03-18 13:22:17 +0200
commit417d1be24c398600600fa631c04c489c0cdd197d (patch)
tree921f0b789928466b79e44a95496da0dfe1eea333 /src
parenta37239a9f5e2db97d49fd40d53d010b013ceeb3a (diff)
status have bonus
Diffstat (limited to 'src')
-rw-r--r--src/sliceitoff/__main__.py1
-rw-r--r--src/sliceitoff/status/status.py32
2 files changed, 16 insertions, 17 deletions
diff --git a/src/sliceitoff/__main__.py b/src/sliceitoff/__main__.py
index bf48169..939bda2 100644
--- a/src/sliceitoff/__main__.py
+++ b/src/sliceitoff/__main__.py
@@ -49,7 +49,6 @@ def sliceitoff():
if game.step():
break
- sleep(2)
pygame.quit()
sliceitoff()
diff --git a/src/sliceitoff/status/status.py b/src/sliceitoff/status/status.py
index 4f2125a..d99c7d5 100644
--- a/src/sliceitoff/status/status.py
+++ b/src/sliceitoff/status/status.py
@@ -12,24 +12,24 @@ class LetterSprite(pygame.sprite.Sprite):
class Status():
- def __init__(self):
- self.score = 6234823999
+ def __init__(self, level = 1):
+ self.score = 0
+ self.bonus = 20_000
self.health = 3
- self.updated = True
+ self.level = level
self.sprites = pygame.sprite.Group()
- def add_score(self, score_to_add):
- self.updated = True
- self.score += score_to_add
-
def update(self, dt):
""" Update sprites basis of dt. dt = milliseconds from last update """
- if self.updated:
- self.sprites.empty()
- y = 280_000
- score_str="{:010d}".format(self.score)
- for letter, x in zip(score_str, range(300_000,400_000,10_000)):
- self.sprites.add(LetterSprite(
- Images.surfaces[f"letter_{letter}"],
- Scaling.scale_to_display((x,y)) ))
- self.updated = False
+
+ self.bonus = max(0, self.bonus - dt)
+
+ self.sprites.empty()
+ y = 280_000
+ #score_str="{:010d}".format(self.score)
+ score_str="{:010d}".format(self.bonus)
+ for letter, x in zip(score_str, range(300_000,400_000,10_000)):
+ self.sprites.add(LetterSprite(
+ Images.surfaces[f"letter_{letter}"],
+ Scaling.scale_to_display((x,y)) ))
+ self.updated = False