changeset 88:7fb822b8c8c9

hints
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Sun, 05 Jan 2014 19:19:39 +0100
parents 55d94c5819c2
children ff724d5f9199
files fujo/title.py
diffstat 1 files changed, 25 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/fujo/title.py	Sun Jan 05 19:02:27 2014 +0100
+++ b/fujo/title.py	Sun Jan 05 19:19:39 2014 +0100
@@ -1,6 +1,8 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
+import random
+
 import pygame
 
 from . import window
@@ -10,6 +12,22 @@
 from .resources import RES
 
 
+HINTS = [
+    "You can hold down CTRL to rotate in place without walking.",
+    "If you press SPACE, you will wait one turn without moving.",
+    "Throwing items at monsters can give interesting results.",
+    "Tanukis can hide by transforming into various things.",
+    "Make sure to equip your weapons and amulets to make use of them.",
+    "Bump into monsters to attack them.",
+    "You always throw in the direction you are currently facing.",
+    "Many monsters will not attack you unless you anger them.",
+    "Monsters can get angry when they see you taking their items.",
+    "Sightseeing can be very therapeutic.",
+    "Once you identify a spell, you will know when you find another like it.",
+    "You lose the items when you throw them.",
+]
+
+
 class Title(object):
     def __init__(self):
         self.screen = pygame.display.get_surface()
@@ -41,26 +59,31 @@
             pygame.mixer.music.play(-1)
         else:
             del options[2]
-        menu = window.Menu((256, 64, 160, 32), options)
+        hint = window.Message((0, -3, 480, 32), ['hint'])
+        self.windows.add(hint)
+        menu = window.Menu((272, 64, 160, 32), options)
         self.screen.blit(RES.title, (0, 0))
+        pygame.display.flip()
         while True:
+            hint.set_lines([random.choice(HINTS)])
             if not saves.valid():
                 options[0] = ('', ' ')
                 if menu.pos == 0:
                     menu.pos = 1
             menu.set_lines(label for choice, label in options)
-            pygame.display.flip()
             choice = menu.run(self)
             if choice == 'start':
                 run = True
                 while run:
                     run = game.Game().run()
                 self.screen.blit(RES.title, (0, 0))
+                pygame.display.flip()
             elif choice == 'continue':
                 run = game.Game().run(saves.load())
                 while run:
                     run = game.Game().run()
                 self.screen.blit(RES.title, (0, 0))
+                pygame.display.flip()
             elif choice == 'music off':
                 pygame.mixer.music.stop()
                 options[2] = ('music on', 'Turn music on')