From d4c8309d1b0e58f66edfd143f2af74a9f9203da0 Mon Sep 17 00:00:00 2001 From: Simon Cross Date: Thu, 8 Sep 2016 23:22:23 +0200 Subject: [PATCH] Add pause button. --- tabakrolletjie/scenes/day.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- 2.34.1