From: Jeremy Thurgood Date: Sat, 17 May 2014 15:47:20 +0000 (+0200) Subject: Add (ugly) countdown timer to tile. X-Git-Tag: 0.1~89 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=db18631120e34670b9f8be526f5b7d5938e1d7fc;p=naja.git Add (ugly) countdown timer to tile. --- 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