changeset 31:3c4db7bba432

Add 's' as a key for starting the game from the menu.
author Simon Cross <hodgestar@gmail.com>
date Sun, 30 Aug 2009 18:56:09 +0000
parents 2eec29085060
children f5f74f1f3a0b
files gamelib/engine.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/engine.py	Sun Aug 30 18:51:28 2009 +0000
+++ b/gamelib/engine.py	Sun Aug 30 18:56:09 2009 +0000
@@ -2,7 +2,7 @@
 
 from pgu.engine import Game, State, Quit
 import pygame
-from pygame.locals import USEREVENT, QUIT, KEYDOWN, K_ESCAPE, K_n, K_d
+from pygame.locals import USEREVENT, QUIT, KEYDOWN, K_ESCAPE, K_n, K_d, K_s
 
 from tiles import TILE_MAP
 import gameboard
@@ -26,8 +26,12 @@
         if events_equal(e, START_DAY):
             self.game.create_game_board()
             return DayState(self.game)
-        elif e.type is KEYDOWN and e.key == K_ESCAPE:
-            return Quit(self.game)
+        elif e.type is KEYDOWN:
+            if e.key == K_ESCAPE:
+                return Quit(self.game)
+            elif e.key == K_s:
+                self.game.create_game_board()
+                return DayState(self.game)
         elif e.type is not QUIT:
             self.game.main_menu_app.event(e)