diff options
author | Viljami Ilola <+@hix.fi> | 2024-03-18 12:41:49 +0200 |
---|---|---|
committer | Viljami Ilola <+@hix.fi> | 2024-03-18 12:41:49 +0200 |
commit | 6eff6d1d8779480c5fb56a9b7fa619209da45423 (patch) | |
tree | 46732aeae2b8c07b74f01cc581ed09a86f66b494 /src/sliceitoff/status/status.py | |
parent | 0442a8e0836c57418375a1f1f923ba4b9f84d01e (diff) |
status -> no get_sprites, separate update
Diffstat (limited to 'src/sliceitoff/status/status.py')
-rw-r--r-- | src/sliceitoff/status/status.py | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/sliceitoff/status/status.py b/src/sliceitoff/status/status.py index bf0e864..5390299 100644 --- a/src/sliceitoff/status/status.py +++ b/src/sliceitoff/status/status.py @@ -18,26 +18,18 @@ class Status(): self.updated = True self.sprites = pygame.sprite.Group() - - def __update_sprites(self): - self.sprites.empty() - y = 28_000 - score_str="{:010d}".format(self.score) - for letter, x in zip(score_str, range(30_000,40_000,1_000)): - self.sprites.add(LetterSprite( - Images.surfaces[f"letter_{letter}"], - Scaling.scale_to_display((x,y)) )) - self.updated = False - def add_score(self, score_to_add): self.updated = True self.score += score_to_add - def get_sprites(self): + def update(self, dt): + """ Update sprites basis of dt. dt = milliseconds from last update """ if self.updated: - self.__update_sprites() - return self.sprites - - def __del__(self): - pass -
\ No newline at end of file + self.sprites.empty() + y = 28_000 + score_str="{:010d}".format(self.score) + for letter, x in zip(score_str, range(30_000,40_000,1_000)): + self.sprites.add(LetterSprite( + Images.surfaces[f"letter_{letter}"], + Scaling.scale_to_display((x,y)) )) + self.updated = False |