5 import pygame.locals as pgl
7 from naja.constants import KEYS
8 from naja.scenes.scene import Scene
9 from naja.widgets.text import TextWidget, TextBoxWidget
10 from naja.events import SceneChangeEvent
13 class HowtoScene(Scene):
15 Tell the player what to do.
18 def __init__(self, state):
19 super(HowtoScene, self).__init__(state)
21 (200, 4), 'How To Play the Game', fontsize=32,
23 self.add(TextBoxWidget(
25 "You are a robot, frantically trying to set the correct "
26 "bits to gain points for reasons that are unlikely to "
28 "You have 8 bits. Four bits control the directions "
29 "you can move in {NORTH,SOUTH,EAST,WEST}, 3 allow you "
30 "to unlock actions {RED,GREEN,BLUE} and the "
31 "last, the Most Significant Bit {MSB}, makes everything "
34 "During Movement, you can explore the board and learn about "
35 "the available tiles. Tiles you can legally move onto are "
36 "highlighted. It's always possible to stay in place.",
38 "After moving, you must select an action. Some actions "
39 "require the correct bits to be set before they can be "
40 "selected. After the action, the tile will be replaced.",
41 "Some actions cost health {HEALTH}. If you run out of "
42 "health {HEALTH}, you lose.",
43 "Some actions gain you points {WINTOKEN}. Once you have "
44 "enough points, you win the game."
46 colour='white', padding=1, border=1,
47 bg_colour='black', border_colour='black',
50 def handle_scene_event(self, ev):
51 from naja.scenes.menu import MenuScene
52 if ev.type == pgl.KEYDOWN and ev.key in KEYS.QUIT:
53 SceneChangeEvent.post(MenuScene)