import os import pygame from display import Scaling from images import Images class LetterSprite(pygame.sprite.Sprite): def __init__(self, image, pos): super().__init__() self.image = image self.rect = self.image.get_rect().move(pos) class Status(): def __init__(self, level = 1): self.score = 0 self.bonus = 20_000 self.health = 3 self.level = level 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) 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