add exit to night
authoradrianna <adrianna.pinska@gmail.com>
Sat, 10 Sep 2016 14:54:05 +0000 (16:54 +0200)
committeradrianna <adrianna.pinska@gmail.com>
Sat, 10 Sep 2016 14:54:44 +0000 (16:54 +0200)
tabakrolletjie/scenes/night.py

index e3b51cb03d14eb34471fc17498028dd489b86673..3f58d921e64ad450d7339390dfefc1c74247c9e0 100644 (file)
@@ -42,8 +42,11 @@ class NightScene(BaseScene):
 
     def create_tools(self, gamestate):
         tools = []
+        y = SCREEN_SIZE[1] - 40
         tools.append(ImageButton(
-            '32', 'pause.png', name='pause play', pos=(SCREEN_SIZE[0] - 150, SCREEN_SIZE[1] - 40)))
+            '32', 'pause.png', name='pause play', pos=(SCREEN_SIZE[0] - 150, y)))
+        tools.append(ImageButton(
+            '32', 'exit.png', name='exit', pos=(SCREEN_SIZE[0] - 50, y)))
         return tools
 
     @debug_timer("night.render")
@@ -96,6 +99,9 @@ class NightScene(BaseScene):
                     if tool.pressed(ev):
                         if tool.name == 'pause play':
                             self.toggle_pause()
+                        elif tool.name == 'exit':
+                            from .menu import MenuScene
+                            SceneChangeEvent.post(scene=MenuScene())
 
     def toggle_pause(self):
         self._paused = not self._paused