5 import pygame.locals as pgl
7 from naja.constants import KEYS, PALETTE
8 from naja.scenes.scene import Scene
9 from naja.sound import sound
10 from naja.widgets.image_box import ImageBox
11 from naja.widgets.text import TextWidget, TextBoxWidget
12 from naja.events import SceneChangeEvent, LoadGameEvent
15 class LoseScene(Scene):
20 def __init__(self, state):
21 super(LoseScene, self).__init__(state)
23 background = ImageBox(
24 (0, 0), "screens/you_lost.png")
27 if self.state.gameboard.has_cheated:
29 (50, 250), 'Even with cheats on.', colour=PALETTE.ORANGE))
31 self.add(TextBoxWidget(
32 (50, 300), '\n\n'.join([
33 "Something went terribly wrong.",
34 "You should re-evaluate your life choices.",
36 "Press ESC to return to the menu",
38 colour='white', padding=1, border=1,
39 bg_colour='black', border_colour='black',
41 sound.play_music('lost.ogg', 0.25)
43 def handle_scene_event(self, ev):
44 from naja.scenes.menu import MenuScene
45 if ev.type == pgl.KEYDOWN and ev.key in KEYS.QUIT:
48 LoadGameEvent.post(None)
49 SceneChangeEvent.post(MenuScene)