diff options
Diffstat (limited to 'src/sliceitoff/player/life.py')
-rw-r--r-- | src/sliceitoff/player/life.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/sliceitoff/player/life.py b/src/sliceitoff/player/life.py index 7d72729..e187201 100644 --- a/src/sliceitoff/player/life.py +++ b/src/sliceitoff/player/life.py @@ -1,12 +1,12 @@ """ player.life - Hearth that will explode """ -import os import pygame -from display import Scaling, CGA_COLORS +from display import Scaling from text import get_letter_surface, ExplodingSprite class PieceOfHearth(ExplodingSprite): + """ Eploding piece. Hearth consist of these """ def __init__(self, image, pos): super().__init__() self.image = image @@ -18,15 +18,16 @@ class Life(pygame.sprite.Group): super().__init__() self.timeout = 0 - def update(self, loselife = False, dt = 0, **kwargs): - explode = True if self.timeout < 1_000 else False - super().update(dt = dt, explode = explode, **kwargs) + def update(self, dt = 0, **kwargs): + """ Quite normal update. Explosion starts when timeout reches 1_000 """ + super().update(dt = dt, explode = self.timeout < 1_000, **kwargs) if self.timeout > 0: self.timeout -= dt else: self.empty() def lose_life(self): + """ Commands group to regenerate its sprites and sets timeout """ self.timeout = 2_000 font_width = int(Scaling.factor * 200_000) block_width = int(Scaling.factor * 8_000) |