summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViljami Ilola <+@hix.fi>2024-04-08 21:09:19 +0300
committerViljami Ilola <+@hix.fi>2024-04-08 21:09:19 +0300
commita433d57a893d3605db5fe1eb501e5ae25d547ac1 (patch)
tree6f0f3c95c18db5269e4a465193d84ecb054bde00
parent9548295de1d343e831baaa2e1c908f70cef0e33a (diff)
docstring and lint
-rw-r--r--src/sliceitoff/player/life.py11
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)