From: Simon Cross Date: Sun, 11 May 2014 17:06:05 +0000 (+0200) Subject: Update scene changing. X-Git-Tag: 0.1~402 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=d56595c827cb4609c03db8691140aeeebc9e4cd7;p=naja.git Update scene changing. --- diff --git a/naja/scenes/credits.py b/naja/scenes/credits.py index 3f592df..46c076f 100644 --- a/naja/scenes/credits.py +++ b/naja/scenes/credits.py @@ -8,6 +8,7 @@ from naja.scenes.scene import Scene from naja.widgets.text import TextWidget from naja.events import SceneChangeEvent + class CreditsScene(Scene): base_menu = None @@ -21,10 +22,8 @@ class CreditsScene(Scene): 'A stranger', fontsize=32, colour='white')) - def handle_event(self, ev): if ev.type == pgl.KEYUP and ev.key in (pgl.K_q, pgl.K_ESCAPE): from naja.scenes.menu import MenuScene - menu_scene = MenuScene() - SceneChangeEvent.post(menu_scene) + SceneChangeEvent.post(MenuScene) return diff --git a/naja/scenes/game.py b/naja/scenes/game.py index 4862500..d6d558c 100644 --- a/naja/scenes/game.py +++ b/naja/scenes/game.py @@ -29,5 +29,5 @@ class GameScene(Scene): def handle_event(self, ev): if ev.type == pgl.KEYUP and ev.key in (pgl.K_q, pgl.K_ESCAPE): - SceneChangeEvent.post(scene=MenuScene()) + SceneChangeEvent.post(MenuScene) return diff --git a/naja/scenes/menu.py b/naja/scenes/menu.py index c2e9a16..6819810 100644 --- a/naja/scenes/menu.py +++ b/naja/scenes/menu.py @@ -27,6 +27,5 @@ class MenuScene(Scene): QuitGameEvent.post() return if ev.type == pgl.KEYDOWN and ev.key is pgl.K_RETURN: - credits_menu = CreditsScene() - SceneChangeEvent.post(credits_menu) + SceneChangeEvent.post(CreditsScene) return