--- /dev/null
+"""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())]
from pgzero.constants import keys
from .base import Scene, ChangeSceneEvent
from .credits import CreditsScene
+from .level import LevelScene
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'))]