From 44344539807cc09f255760369e1ed2fcdef8065c Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 17 May 2014 17:05:03 +0200 Subject: [PATCH] Drop state when the game is over (after we've found out if we're cheating or not) --- naja/scenes/lose.py | 4 +++- naja/scenes/win.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) 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 -- 2.34.1