changeset 222:322e6d3a46e4

Turn 'd' into a fast forward / normal speed toggle at night
author Neil Muller <drnlmuller@gmail.com>
date Fri, 04 Sep 2009 22:38:48 +0000
parents d46ae64240a1
children 527a5d4e3fa3
files TODO gamelib/engine.py
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/TODO	Fri Sep 04 22:31:16 2009 +0000
+++ b/TODO	Fri Sep 04 22:38:48 2009 +0000
@@ -39,7 +39,6 @@
 
   -- Game over & time limit implemented with final score.
   -- High score support still needed (pgu.high ?)
-  -- Need to remove current 'd' shortcut
   -- Should esc take us to a different state than won / lost?
 
 * <tzhau> simchicken! so are there gonna to be chicken processing plants? escaping chickens?
--- a/gamelib/engine.py	Fri Sep 04 22:31:16 2009 +0000
+++ b/gamelib/engine.py	Fri Sep 04 22:38:48 2009 +0000
@@ -153,7 +153,8 @@
         sound.play_sound("nightfall.ogg")
         # Add a timer to the event queue
         self.cycle_count = 0
-        pygame.time.set_timer(MOVE_FOX_ID, 200)
+        self.cycle_time = 200
+        pygame.time.set_timer(MOVE_FOX_ID, self.cycle_time)
         pygame.time.set_timer(ANIM_ID, 50)
         self.game.gameboard.spawn_foxes()
         sound.background_music("nighttime.ogg")
@@ -166,7 +167,13 @@
                 return GameOver(self.game)
             return DayState(self.game)
         elif e.type is KEYDOWN and e.key == K_d:
-            return pygame.event.post(START_DAY)
+            if self.cycle_time > 100:
+                self.cycle_time = 50  
+                pygame.time.set_timer(ANIM_ID, 25)
+            else:
+                self.cycle_time = 200
+                pygame.time.set_timer(ANIM_ID, 50)
+            pygame.time.set_timer(MOVE_FOX_ID, self.cycle_time)
         elif e.type is KEYDOWN and e.key == K_ESCAPE:
             self.game.gameboard.set_cursor()
             return GameOver(self.game)