Add very placeholder level scene
authorNeil <neil@dip.sun.ac.za>
Sun, 28 Feb 2016 19:40:11 +0000 (21:40 +0200)
committerNeil <neil@dip.sun.ac.za>
Sun, 28 Feb 2016 19:40:23 +0000 (21:40 +0200)
koperkapel/scenes/level.py [new file with mode: 0644]
koperkapel/scenes/menu.py

diff --git a/koperkapel/scenes/level.py b/koperkapel/scenes/level.py
new file mode 100644 (file)
index 0000000..c29ffc0
--- /dev/null
@@ -0,0 +1,23 @@
+"""Render a level"""
+
+import json
+
+from pgzero.constants import keys
+from .base import Scene, ChangeSceneEvent
+
+
+class LevelScene(Scene):
+    """ Level scene. """
+
+
+    def __init__(self, level_name):
+        self._level_name = level_name
+
+    def draw(self, screen):
+        screen.clear()
+        screen.draw.text("This is level {}".format(self._level_name), (200, 100))
+
+    def on_key_down(self, key, mod, unicode):
+        if key == keys.ESCAPE:
+            from .menu import MenuScene
+            return [ChangeSceneEvent(MenuScene())]
index dac4402bd53643cf06c0a1add5a5be1164316418..63e1ba84ae48891201f24376fc3c002a5d6880bd 100644 (file)
@@ -3,6 +3,7 @@
 from pgzero.constants import keys
 from .base import Scene, ChangeSceneEvent
 from .credits import CreditsScene
+from .level import LevelScene
 
 
 class MenuScene(Scene):
@@ -15,3 +16,5 @@ class MenuScene(Scene):
     def on_key_down(self, key, mod, unicode):
         if key == keys.C:
             return [ChangeSceneEvent(CreditsScene())]
+        if key == keys.L:
+            return [ChangeSceneEvent(LevelScene('level1'))]