Minor cleanup.
[naja.git] / naja / scenes / lose.py
index b7b9e3c0ee159fb22fa75f75eefc9afec0012ad2..7455fdf60387ad39529151ecbc33b117795b6394 100644 (file)
@@ -6,9 +6,10 @@ import pygame.locals as pgl
 
 from naja.constants import KEYS, PALETTE
 from naja.scenes.scene import Scene
+from naja.sound import sound
 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):
@@ -23,10 +24,6 @@ class LoseScene(Scene):
             (0, 0), "screens/you_lost.png")
         self.add(background)
 
-
-        #self.add(TextWidget(
-        #    (50, 50), 'You lost!', colour=PALETTE.WHITE))
-
         if self.state.gameboard.has_cheated:
             self.add(TextWidget(
                 (50, 250), 'Even with cheats on.', colour=PALETTE.ORANGE))
@@ -41,9 +38,13 @@ class LoseScene(Scene):
             colour='white', padding=1, border=1,
             bg_colour='black', border_colour='black',
             box_width=300))
+        sound.play_music('lost.ogg', 0.25)
 
     def handle_scene_event(self, ev):
         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