From: Simon Cross Date: Thu, 8 Sep 2016 21:22:23 +0000 (+0200) Subject: Add pause button. X-Git-Tag: tabakrolletjie-v1.0.0~176 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=d4c8309d1b0e58f66edfd143f2af74a9f9203da0;p=tabakrolletjie.git Add pause button. --- diff --git a/tabakrolletjie/scenes/day.py b/tabakrolletjie/scenes/day.py index 453ccf1..003ae1b 100644 --- a/tabakrolletjie/scenes/day.py +++ b/tabakrolletjie/scenes/day.py @@ -24,6 +24,7 @@ class DayScene(BaseScene): self._turnips = [] self._seeds = gamestate.seeds self._harvested = gamestate.harvested + self._paused = False self._tool = None for turnip_data in gamestate.turnips: turnip = Turnip(space=self._space, **turnip_data) @@ -70,6 +71,8 @@ class DayScene(BaseScene): if ev.key == pgl.K_e: from .night import NightScene SceneChangeEvent.post(scene=NightScene()) + if ev.key == pgl.K_SPACE: + self._paused = not self._paused elif ev.type == pgl.MOUSEBUTTONDOWN: if ev.button == 1: # Check tools @@ -105,7 +108,8 @@ class DayScene(BaseScene): @debug_timer("day.tick") def tick(self, gamestate): - self._lights.tick() + if not self._paused: + self._lights.tick() def _update_toolbar(self): pass