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
|
|
25 hatch a new chicken. Chickens that hatch in already full henhouses die
|
|
26 immediately from overcrowding.
|
|
27 """ % constants.NAME
|
|
28
|
|
29 def make_help_screen():
|
|
30 """Create a main menu"""
|
|
31 help_screen = HelpScreen(width=600)
|
|
32
|
|
33 c = HelpContainer(align=0, valign=0)
|
|
34 c.add(help_screen, 0, 0)
|
|
35
|
|
36 return c
|
|
37
|
|
38 class HelpContainer(gui.Container):
|
|
39 def paint(self, s):
|
|
40 pygame.display.set_caption('Instructions')
|
|
41 splash = imagecache.load_image("images/splash.png")
|
|
42 pygame.display.get_surface().blit(splash, (0, 0))
|
|
43 gui.Container.paint(self, s)
|
|
44
|
|
45 class HelpScreen(gui.Document):
|
|
46 def __init__(self, **params):
|
|
47 gui.Document.__init__(self, **params)
|
|
48
|
|
49 def done_pressed():
|
|
50 pygame.event.post(engine.GO_MAIN_MENU)
|
|
51
|
|
52 done_button = gui.Button("Return to Main Menu")
|
|
53 done_button.connect(gui.CLICK, done_pressed)
|
|
54
|
|
55 space = self.style.font.size(" ")
|
|
56
|
|
57 for paragraph in HELP.split('\n\n'):
|
|
58 self.block(align=-1)
|
|
59 for word in paragraph.split():
|
|
60 self.add(gui.Label(word))
|
|
61 self.space(space)
|
|
62 self.br(space[1])
|
|
63 self.br(space[1])
|
|
64 self.block(align=0)
|
|
65 self.add(done_button, align=0)
|