From 61a1248e340d1c87a6c4e7dec77f1089984b87b6 Mon Sep 17 00:00:00 2001 From: Viljami Ilola <+@hix.fi> Date: Wed, 27 Mar 2024 15:06:36 +0200 Subject: slicing reduces score --- src/sliceitoff/game/gameplay.py | 1 + src/sliceitoff/screens/welcome.py | 18 +++++++++--------- src/sliceitoff/stats/stats.py | 5 +++++ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/sliceitoff/game/gameplay.py b/src/sliceitoff/game/gameplay.py index e1f17ab..028536c 100644 --- a/src/sliceitoff/game/gameplay.py +++ b/src/sliceitoff/game/gameplay.py @@ -24,6 +24,7 @@ class Gameplay: 4_000) if not zap_sprite: return False + Stats.add_score(-500) if pygame.sprite.spritecollideany(zap_sprite, self.enemies): if Stats.lose_life(): return True diff --git a/src/sliceitoff/screens/welcome.py b/src/sliceitoff/screens/welcome.py index 4f5eb2b..f3fd25e 100644 --- a/src/sliceitoff/screens/welcome.py +++ b/src/sliceitoff/screens/welcome.py @@ -2,19 +2,19 @@ from text import TextPage def welcome_screen(): return TextPage( - " Slice it off!\n" + " Slice it off!\n" " \n" " Your mission:\n" - " * Slice area to target\n" - " * Slice no-one\n" + " * Slice area to 20%\n" + " * Slice no-one\n" "\n" " Gain score by:\n" - " * Keeping herd together\n" - " * Not slicing unnecessarily\n" - " * Making area even smaller\n" - " * Not losing lives\n" - " * Being fast\n" - " * Leveling up\n", + " * Keeping herd together\n" + " * Not slicing unnecessarily\n" + " * Making area even smaller\n" + " * Not losing lives\n" + " * Being fast\n" + " * Leveling up\n", font = 'computer', size = (8_000, 16_000), grid = (9_000, 16_000) ) diff --git a/src/sliceitoff/stats/stats.py b/src/sliceitoff/stats/stats.py index 4024e53..79da2c9 100644 --- a/src/sliceitoff/stats/stats.py +++ b/src/sliceitoff/stats/stats.py @@ -32,6 +32,11 @@ class Stats: def lose_life(): __class__.lives -= 1 return not __class__.lives + + @staticmethod + def add_score(score_to_add): + __class__.score += score_to_add + __class__.score = max(0, __class__.score) @staticmethod def calc_bonus(): -- cgit v1.2.3