From a23b6647b0ca2cd9f2ccbbe12360c3fa0f96a554 Mon Sep 17 00:00:00 2001 From: Viljami Ilola <+@hix.fi> Date: Sat, 16 Mar 2024 12:35:07 +0200 Subject: scaling as class --- src/sliceitoff/status/status.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/sliceitoff/status') diff --git a/src/sliceitoff/status/status.py b/src/sliceitoff/status/status.py index afff7f7..ed36711 100644 --- a/src/sliceitoff/status/status.py +++ b/src/sliceitoff/status/status.py @@ -5,15 +5,14 @@ from display import Scaling from images import images class LetterSprite(pygame.sprite.Sprite): - def __init__(self, image, x, y): + def __init__(self, image, pos): super().__init__() self.image = image - self.rect = self.image.get_rect().move(x,y) + self.rect = self.image.get_rect().move(pos) class Status(): - def __init__(self, scaling: Scaling = None): - self.scaling = scaling if scaling else Scaling(50,0,0) + def __init__(self): self.score = 6234823999 self.health = 3 self.updated = True @@ -27,8 +26,7 @@ class Status(): for letter, x in zip(score_str, range(30000,40000,1000)): self.sprites.add(LetterSprite( images[f"letter_{letter}"], - x*self.scaling.scale+self.scaling.left, - y*self.scaling.scale+self.scaling.top)) + Scaling.scale_coordinates((x,y)) )) self.updated = False def add_score(self, score_to_add): -- cgit v1.2.3