diff options
author | Viljami Ilola <+@hix.fi> | 2024-03-20 17:46:10 +0200 |
---|---|---|
committer | Viljami Ilola <+@hix.fi> | 2024-03-20 17:46:10 +0200 |
commit | 975e5dca49fb09fe2f762462f1c337c0d63735bf (patch) | |
tree | 4c837b346d7b7e4a9246c1be846f48d787a327ba /src/sliceitoff/text/text.py | |
parent | 398eebe7829622c6983cb28528f2208b4d596f32 (diff) |
exploding text
Diffstat (limited to 'src/sliceitoff/text/text.py')
-rw-r--r-- | src/sliceitoff/text/text.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/sliceitoff/text/text.py b/src/sliceitoff/text/text.py index f01e517..e86bede 100644 --- a/src/sliceitoff/text/text.py +++ b/src/sliceitoff/text/text.py @@ -12,8 +12,20 @@ class LetterSprite(pygame.sprite.Sprite): self.image = image self.rect = self.image.get_rect().move(pos) self.direction = ( - Scaling.factor * 40 * 1_000 + randrange(4_000), - Scaling.factor * 40 * 1_000 + randrange(4_000)) + Scaling.factor * (2_000 - randrange(4_000)), + Scaling.factor * (2_000 - randrange(4_000))) + + def update(self, explode=0): + if explode: + self.rect = pygame.Rect( + self.rect.x + self.direction[0] * explode, + self.rect.y + self.direction[1] * explode, + self.rect.w, + self.rect.h) + self.direction = ( + self.direction[0] * 1.15, + self.direction[1] * 1.15) + class TextPage(pygame.sprite.Group): def __init__( |