diff options
Diffstat (limited to 'src/sliceitoff/text/text.py')
-rw-r--r-- | src/sliceitoff/text/text.py | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/src/sliceitoff/text/text.py b/src/sliceitoff/text/text.py index c429110..69fee77 100644 --- a/src/sliceitoff/text/text.py +++ b/src/sliceitoff/text/text.py @@ -1,10 +1,9 @@ """ text.text - letters, texts and scaling and coloring of fonts """ -from random import randrange - import pygame from display import Scaling, CGA_COLORS from .fonts import Fonts +from .explode import ExplodingSprite scaled_fonts = {} @@ -31,28 +30,13 @@ def get_letter_surface(font_key, ch): return scaled_fonts[font_key][ch] -class LetterSprite(pygame.sprite.Sprite): +class LetterSprite(ExplodingSprite): """ Make sprite out of letter surface at given position """ def __init__(self, font_key, ch, pos): super().__init__() self.dead = True self.image = get_letter_surface(font_key, ch) self.rect = self.image.get_rect().move(pos) - self.direction = ( - Scaling.factor * (1_000 - randrange(2_000)), - Scaling.factor * (1_000 - randrange(2_000))) - - def update(self, dt = 0, explode = 0): - """ All the movements for letters """ - if explode and dt: - self.rect = pygame.Rect( - self.rect.x + self.direction[0] * dt, - self.rect.y + self.direction[1] * dt, - self.rect.w, - self.rect.h) - self.direction = ( - self.direction[0] * 0.95, - self.direction[1] * 0.95 + 0.3) class TextPage(pygame.sprite.Group): """ Creates sprite group out of given text and parameters |