Mercurial > rinkhals
annotate gamelib/helpscreen.py @ 286:49418fd43748
Price reference dialog - without close button
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sat, 05 Sep 2009 15:41:48 +0000 |
parents | fa0e818c3fee |
children | 2688ce607d65 |
rev | line source |
---|---|
179 | 1 """Help screen.""" |
2 | |
3 from pgu import gui | |
4 import pygame | |
5 import constants | |
6 import engine | |
7 import imagecache | |
8 | |
9 HELP="""Welcome to %s | |
10 | |
11 Introduction: | |
12 | |
13 The aim of the game is to make as much money as possible from your chicken | |
14 farm. The problem is the foxes, which want to eat your chickens. Since hiring | |
15 guards is both too expensive and unreliable, the obvious solution is to help | |
16 the chickens defend themselves. | |
17 | |
18 Game mechanics: | |
19 | |
20 You lose if you end a night with no chickens left. | |
21 | |
22 You win if you survive 14 nights. | |
23 | |
24 Chickens only lay eggs in henhouses, and must stay on the egg for 2 days to | |
230
fa0e818c3fee
Update instructions to match new chick hatching behaviour.
Simon Cross <hodgestar@gmail.com>
parents:
181
diff
changeset
|
25 hatch a new chicken. Chickens that hatch in already full henhouses are |
fa0e818c3fee
Update instructions to match new chick hatching behaviour.
Simon Cross <hodgestar@gmail.com>
parents:
181
diff
changeset
|
26 moved to just outside. If there is no space outside, they die immediately |
fa0e818c3fee
Update instructions to match new chick hatching behaviour.
Simon Cross <hodgestar@gmail.com>
parents:
181
diff
changeset
|
27 from overcrowding. |
179 | 28 """ % constants.NAME |
29 | |
30 def make_help_screen(): | |
31 """Create a main menu""" | |
32 help_screen = HelpScreen(width=600) | |
33 | |
34 c = HelpContainer(align=0, valign=0) | |
35 c.add(help_screen, 0, 0) | |
36 | |
37 return c | |
38 | |
39 class HelpContainer(gui.Container): | |
40 def paint(self, s): | |
41 pygame.display.set_caption('Instructions') | |
181
7e556ef40100
Lighten help screen. Fix some oddities in darken modifier.
Simon Cross <hodgestar@gmail.com>
parents:
179
diff
changeset
|
42 splash = imagecache.load_image("images/splash.png", ["lighten_most"]) |
179 | 43 pygame.display.get_surface().blit(splash, (0, 0)) |
44 gui.Container.paint(self, s) | |
45 | |
46 class HelpScreen(gui.Document): | |
47 def __init__(self, **params): | |
48 gui.Document.__init__(self, **params) | |
49 | |
50 def done_pressed(): | |
51 pygame.event.post(engine.GO_MAIN_MENU) | |
52 | |
53 done_button = gui.Button("Return to Main Menu") | |
54 done_button.connect(gui.CLICK, done_pressed) | |
55 | |
56 space = self.style.font.size(" ") | |
57 | |
58 for paragraph in HELP.split('\n\n'): | |
59 self.block(align=-1) | |
60 for word in paragraph.split(): | |
61 self.add(gui.Label(word)) | |
62 self.space(space) | |
63 self.br(space[1]) | |
64 self.br(space[1]) | |
65 self.block(align=0) | |
66 self.add(done_button, align=0) |