Add (ugly) countdown timer to tile.
authorJeremy Thurgood <firxen@gmail.com>
Sat, 17 May 2014 15:47:20 +0000 (17:47 +0200)
committerJeremy Thurgood <firxen@gmail.com>
Sat, 17 May 2014 15:47:58 +0000 (17:47 +0200)
naja/scenes/howto.py
naja/widgets/tile.py

index de113de8c494a543bdefebaf273a8a263624c531..560aca48e7ba971a015af59fc8502d5f4218d7a3 100644 (file)
@@ -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,
index 5417dcf3ba3e4e8960c829d76dc8e7c4353a09cf..344a924ae27b0dcb99546b6e38d02a77b82aaa92 100644 (file)
@@ -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