7 import pygame.locals as pgl
9 from naja.constants import KEYS, FPS
10 from naja.scenes.scene import Scene
11 from naja.utils import Flashlight
12 from naja.widgets.text import TextWidget, TextBoxWidget
13 from naja.widgets.image_box import ImageBox
14 from naja.events import SceneChangeEvent
17 class CreditsScene(Scene):
19 List those responsible.
22 def __init__(self, state):
23 super(CreditsScene, self).__init__(state)
24 self.flashlight = Flashlight(int(1.5 * FPS))
26 background = ImageBox(
27 (0, 0), "screens/splash.png")
30 (400, 300), 'CREDITS', colour='white', centre=True))
32 self.credits = TextBoxWidget(
33 (400, 340), '\n'.join([
34 'A game about robots and bits and other things',
38 u'Adrianna PiĆska, David Sharpe, Jeremy Thurgood, '
39 u'Neil Muller, Simon Cross & Stefano Rivera',
44 'for snacks and tutorial inspiration',
46 'Bearnard Hibbins, Graham Inggs,',
47 'and William Stewart',
48 'for playtesting and finding bugs',
50 'Music by Rolemusic:',
51 'http://rolemusic.sawsquarenoise.com/',
53 'Out of credits. Insert coin.',
54 '(Press ESC to return to the menu.)',
56 colour='white', padding=1,
57 bg_colour=(0, 0, 0, 0), centre=True,
58 box_width=780, view_port=(780, 250))
59 self.add(self.credits)
61 def render_scene(self, surface):
62 if self.flashlight is not None:
63 if self.flashlight.tick():
64 fake_event = pygame.event.Event(pgl.KEYDOWN, key=pgl.K_DOWN)
65 self.credits.handle_event(fake_event)
67 def handle_event(self, ev):
68 if ev.type == pgl.KEYDOWN:
69 self.flashlight = None
70 return super(CreditsScene, self).handle_event(ev)
72 def handle_scene_event(self, ev):
73 if ev.type == pgl.KEYDOWN and ev.key in KEYS.QUIT:
74 from naja.scenes.menu import MenuScene
75 SceneChangeEvent.post(MenuScene)