From db18631120e34670b9f8be526f5b7d5938e1d7fc Mon Sep 17 00:00:00 2001 From: Jeremy Thurgood Date: Sat, 17 May 2014 17:47:20 +0200 Subject: [PATCH] Add (ugly) countdown timer to tile. --- naja/scenes/howto.py | 2 ++ naja/widgets/tile.py | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/naja/scenes/howto.py b/naja/scenes/howto.py index de113de..560aca4 100644 --- a/naja/scenes/howto.py +++ b/naja/scenes/howto.py @@ -47,6 +47,8 @@ class HowtoScene(Scene): "health {HEALTH}, you lose.", "Some actions gain you points {WINTOKEN}. Once you have " "enough points, you win the game.", + "Some tiles have a coutdown timer in the top right corner. " + "If this timer is + it means more than 9 turns remain.", "", "Press ESC to return to the menu.", ]), fontsize=32, diff --git a/naja/widgets/tile.py b/naja/widgets/tile.py index 5417dcf..344a924 100644 --- a/naja/widgets/tile.py +++ b/naja/widgets/tile.py @@ -6,6 +6,7 @@ from naja.constants import ( from naja.resources import resources from naja.resources.mutators import EIGHT_BIT, blender from naja.widgets.base import Widget +from naja.widgets.text import TextBoxWidget BIT_MAP = { @@ -74,6 +75,15 @@ class TileWidget(Widget): for action in card.actions: y_offset = self._prepare_action(action, y_offset) + if card.replacement_time is not None: + timestr = str(card.replacement_time) + if len(timestr) > 1: + timestr = '+' + countdown_text = TextBoxWidget( + (TILE_SIZE[0] - 24, 4), timestr, padding=2, + colour=PALETTE.PINK, bg_colour=PALETTE.DARK_RED) + countdown_text.render(self.surface) + def _prepare_lock(self, action, y_offset): if not action.required_bits: return 4 -- 2.34.1