From: Neil Date: Sat, 17 May 2014 15:05:03 +0000 (+0200) Subject: Drop state when the game is over (after we've found out if we're cheating or not) X-Git-Tag: 0.1~95^2 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=44344539807cc09f255760369e1ed2fcdef8065c;p=naja.git Drop state when the game is over (after we've found out if we're cheating or not) --- diff --git a/naja/scenes/lose.py b/naja/scenes/lose.py index b7b9e3c..ccd0acc 100644 --- a/naja/scenes/lose.py +++ b/naja/scenes/lose.py @@ -8,7 +8,7 @@ from naja.constants import KEYS, PALETTE from naja.scenes.scene import Scene from naja.widgets.image_box import ImageBox from naja.widgets.text import TextWidget, TextBoxWidget -from naja.events import SceneChangeEvent +from naja.events import SceneChangeEvent, LoadGameEvent class LoseScene(Scene): @@ -45,5 +45,7 @@ class LoseScene(Scene): def handle_scene_event(self, ev): from naja.scenes.menu import MenuScene if ev.type == pgl.KEYDOWN and ev.key in KEYS.QUIT: + # drop current state + LoadGameEvent.post(None) SceneChangeEvent.post(MenuScene) return diff --git a/naja/scenes/win.py b/naja/scenes/win.py index cb3275d..59efdb9 100644 --- a/naja/scenes/win.py +++ b/naja/scenes/win.py @@ -5,7 +5,7 @@ Win scene. import pygame.locals as pgl from naja.constants import KEYS, PALETTE -from naja.events import SceneChangeEvent +from naja.events import SceneChangeEvent, LoadGameEvent from naja.sound import sound from naja.scenes.scene import Scene from naja.widgets.image_box import ImageBox @@ -44,5 +44,7 @@ class WinScene(Scene): from naja.scenes.menu import MenuScene if ev.type == pgl.KEYDOWN and ev.key in KEYS.QUIT: sound.stop() + # drop current state + LoadGameEvent.post(None) SceneChangeEvent.post(MenuScene) return