Mercurial > rinkhals
changeset 237:4a87bfa5cc63
Twiddle animation cycle
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sat, 05 Sep 2009 09:48:48 +0000 |
parents | 9a6ac9c9ff46 |
children | 1a7097c0fc8f |
files | gamelib/animations.py gamelib/engine.py |
diffstat | 2 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/gamelib/animations.py Sat Sep 05 09:46:29 2009 +0000 +++ b/gamelib/animations.py Sat Sep 05 09:48:48 2009 +0000 @@ -13,8 +13,9 @@ the sprites list. Ideally, animations should be quite short.""" - # In the current implementation, sequences longer than 3 frames + # In the current implementation, sequences longer than 4 frames # will cause issues as this will overrun the next move loop. + # (assuming all animations are triggered by the move loop, of course) def __init__(self, sequence, tile_pos): # Create the first frame
--- a/gamelib/engine.py Sat Sep 05 09:46:29 2009 +0000 +++ b/gamelib/engine.py Sat Sep 05 09:48:48 2009 +0000 @@ -110,7 +110,7 @@ sound.play_sound("daybreak.ogg") # disable timer pygame.time.set_timer(MOVE_FOX_ID, 0) - pygame.time.set_timer(ANIM_ID, 50) + pygame.time.set_timer(ANIM_ID, SLOW_ANIM_SPEED) self.game.gameboard.advance_day() self.game.gameboard.clear_foxes() sound.background_music("daytime.ogg") @@ -181,6 +181,8 @@ # Timer aren't nessecairly ordered, so we make sure # we don't get a ANIM event until at least cycle after this pygame.time.set_timer(ANIM_ID, self.cycle_time) + # Ensure any outstanding animitions get cleaned up + self.game.gameboard.run_animations() self.cycle_count += 1 if self.cycle_count > constants.NIGHT_LENGTH: return pygame.event.post(START_DAY)