""" Main menu scene. """
from pgzero.constants import keys
+from ..actors.buttons import TextButton
from .base import Scene, ChangeSceneEvent
-from .credits import CreditsScene
-from .level import LevelScene
class MenuScene(Scene):
""" Main menu scene. """
- def draw(self, screen):
- screen.clear()
- screen.draw.text("Main menu", (300, 300))
+ def __init__(self):
+ super().__init__()
+ self._title = self.actors.add(TextButton("Main Menu"))
+ self._title.pos = (300, 200)
+ self._level = self.actors.add(TextButton("Level"))
+ self._level.pos = (300, 300)
+ self._credits = self.actors.add(TextButton("Credits"))
+ self._credits.pos = (300, 400)
def on_key_down(self, key, mod, unicode):
if key == keys.C:
+ from .credits import CreditsScene
return [ChangeSceneEvent(CreditsScene())]
+ if key == keys.L:
++ from .level import LevelScene
+ return [ChangeSceneEvent(LevelScene('level1'))]