From a433d57a893d3605db5fe1eb501e5ae25d547ac1 Mon Sep 17 00:00:00 2001 From: Viljami Ilola <+@hix.fi> Date: Mon, 8 Apr 2024 21:09:19 +0300 Subject: docstring and lint --- src/sliceitoff/player/life.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') 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) -- cgit v1.2.3