Add pause button.
authorSimon Cross <hodgestar@gmail.com>
Thu, 8 Sep 2016 21:22:23 +0000 (23:22 +0200)
committerSimon Cross <hodgestar@gmail.com>
Thu, 8 Sep 2016 21:22:23 +0000 (23:22 +0200)
tabakrolletjie/scenes/day.py

index 453ccf1001bb92fdbff2a14e04b11ba28da2d5e5..003ae1b596dbec5e3a49c85980490a36060aca68 100644 (file)
@@ -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