From: adrianna Date: Sat, 17 May 2014 10:09:57 +0000 (+0200) Subject: hooked up win and lose screens X-Git-Tag: 0.1~135 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=52ea2942029fb4bb33d17e19ba2919607c234e8f;p=naja.git hooked up win and lose screens --- diff --git a/naja/scenes/lose.py b/naja/scenes/lose.py index af41bb2..40600a7 100644 --- a/naja/scenes/lose.py +++ b/naja/scenes/lose.py @@ -4,8 +4,9 @@ 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.widgets.image_box import ImageBox from naja.widgets.text import TextWidget, TextBoxWidget from naja.events import QuitGameEvent @@ -17,17 +18,22 @@ class LoseScene(Scene): def __init__(self, state): super(LoseScene, self).__init__(state) + + background = ImageBox( + (0, 0), "screens/you_lost.png") + self.add(background) + + self.add(TextWidget( - (480, 160), 'You lost!', fontsize=32, colour='white')) + (50, 50), 'You lost!', colour=PALETTE.WHITE)) self.add(TextBoxWidget( - (120, 30), '\n'.join([ - "You're not so great.", - "You did poorly.", - "You shouldn't be proud of yourself.", + (50, 100), '\n\n'.join([ + "Something went terribly wrong.", + "You should re-evaluate your life choices.", ]), fontsize=32, colour='white', padding=1, border=1, bg_colour='black', border_colour='black', - box_width=400)) + box_width=300)) def handle_scene_event(self, ev): if ev.type == pgl.KEYDOWN and ev.key in KEYS.QUIT: diff --git a/naja/scenes/win.py b/naja/scenes/win.py index c4a09a8..8f52cc4 100644 --- a/naja/scenes/win.py +++ b/naja/scenes/win.py @@ -7,6 +7,7 @@ import pygame.locals as pgl from naja.constants import KEYS, PALETTE from naja.events import QuitGameEvent from naja.scenes.scene import Scene +from naja.widgets.image_box import ImageBox from naja.widgets.text import TextWidget, TextBoxWidget @@ -17,6 +18,11 @@ class WinScene(Scene): def __init__(self, state): super(WinScene, self).__init__(state) + + background = ImageBox( + (0, 0), "screens/you_won.png") + self.add(background) + self.add(TextWidget((50, 50), 'You won!', colour=PALETTE.WHITE)) if self.state.gameboard.has_cheated: self.add(TextWidget(