X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=naja%2Fscenes%2Flose.py;h=be9b60309a145ccf7db53b38b63af99f3731b27d;hb=refs%2Fheads%2Ffeature%2F20140608-non-modal-controls;hp=e72d5f4e8995e538e0a962f628a6e7100191d313;hpb=ee043bf16a47565d7781bd8a357f803a98bd8a4b;p=naja.git diff --git a/naja/scenes/lose.py b/naja/scenes/lose.py index e72d5f4..be9b603 100644 --- a/naja/scenes/lose.py +++ b/naja/scenes/lose.py @@ -4,10 +4,12 @@ Lose scene. import pygame.locals as pgl -from naja.constants import KEYS +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 QuitGameEvent +from naja.events import SceneChangeEvent, LoadGameEvent class LoseScene(Scene): @@ -17,19 +19,34 @@ class LoseScene(Scene): def __init__(self, state): super(LoseScene, self).__init__(state) - self.add(TextWidget( - (480, 160), 'You lost!', fontsize=32, colour='white')) + + background = ImageBox( + (0, 0), "screens/you_lost.png") + self.add(background) + + y_offset = 250 + + if self.state.gameboard.has_cheated: + self.add(TextWidget( + (50, y_offset), 'Even with cheats on.', colour=PALETTE.ORANGE)) + y_offset += 50 + self.add(TextBoxWidget( - (120, 30), '\n'.join([ - "You're not so great.", - "You did poorly.", - "You shouldn't be proud of yourself.", + (50, y_offset), '\n\n'.join([ + "Something went terribly wrong.", + "You should re-evaluate your life choices.", + "Press ESC to return to the menu", ]), fontsize=32, colour='white', padding=1, border=1, bg_colour='black', border_colour='black', - box_width=100)) + 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: - QuitGameEvent.post() + sound.stop() + # drop current state + LoadGameEvent.post(None) + SceneChangeEvent.post(MenuScene) return