Mercurial > rinkhals
diff gamelib/animations.py @ 251:844bfb23d4b6
Refactored animal death and added death animations.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sat, 05 Sep 2009 12:35:37 +0000 |
parents | 1a7000c8211c |
children | a655ae452b4e |
line wrap: on
line diff
--- a/gamelib/animations.py Sat Sep 05 12:34:32 2009 +0000 +++ b/gamelib/animations.py Sat Sep 05 12:35:37 2009 +0000 @@ -17,8 +17,10 @@ # 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): + def __init__(self, tile_pos, sequence=None): # Create the first frame + if sequence is None: + sequence = self.SEQUENCE self.iter = iter(sequence) Sprite.__init__(self, self.iter.next(), (-1000, -1000)) if hasattr(tile_pos, 'to_tuple'): @@ -52,18 +54,21 @@ def __init__(self, chicken): if chicken.facing == 'right': - Animation.__init__(self, self.SEQUENCE_RIGHT, chicken.pos) + Animation.__init__(self, chicken.pos, self.SEQUENCE_RIGHT) else: - Animation.__init__(self, self.SEQUENCE_LEFT, chicken.pos) + Animation.__init__(self, chicken.pos, self.SEQUENCE_LEFT) class FenceExplosion(Animation): - FLASH_LEFT = imagecache.load_image('sprites/muzzle_flash.png') FLASH_RIGHT = imagecache.load_image('sprites/muzzle_flash.png', ("right_facing",)) - SEQUENCE = [FLASH_LEFT, FLASH_RIGHT, FLASH_LEFT, FLASH_RIGHT] - def __init__(self, fencetile): - Animation.__init__(self, self.SEQUENCE, fencetile) - +class FoxDeath(Animation): + BLOOD_SPLAT = imagecache.load_image('sprites/fox_death.png') + SEQUENCE = [BLOOD_SPLAT, BLOOD_SPLAT] + +class ChickenDeath(Animation): + BLOOD_SPLAT = imagecache.load_image('sprites/fox_death.png') + FEATHER_SPLAT = imagecache.load_image('sprites/chkn_death.png') + SEQUENCE = [BLOOD_SPLAT, FEATHER_SPLAT, FEATHER_SPLAT]