5 import pygame.locals as pgl
7 from naja.constants import KEYS, PALETTE
8 from naja.events import SceneChangeEvent, LoadGameEvent
9 from naja.sound import sound
10 from naja.scenes.scene import Scene
11 from naja.widgets.image_box import ImageBox
12 from naja.widgets.text import TextWidget, TextBoxWidget
15 class WinScene(Scene):
20 def __init__(self, state):
21 super(WinScene, self).__init__(state)
23 background = ImageBox(
24 (0, 0), "screens/you_won.png")
29 if self.state.gameboard.has_cheated:
31 (50, y_offset), 'But you\'re a CHEATER!', colour=PALETTE.ORANGE))
34 self.add(TextBoxWidget(
35 (50, y_offset), '\n\n'.join([
38 "You should be proud of yourself.",
39 "Press ESC to return to the menu",
41 colour=PALETTE.WHITE, padding=1, border=1,
42 bg_colour=PALETTE.BLACK, border_colour=PALETTE.BLACK,
44 sound.play_music('A_ninja.ogg', 0.25)
46 def handle_scene_event(self, ev):
47 from naja.scenes.menu import MenuScene
48 if ev.type == pgl.KEYDOWN and ev.key in KEYS.QUIT:
51 LoadGameEvent.post(None)
52 SceneChangeEvent.post(MenuScene)