diff gamelib/equipment.py @ 202:3074784c93f4

Animation support
author Neil Muller <drnlmuller@gmail.com>
date Fri, 04 Sep 2009 20:23:30 +0000
parents 67d10f7e0159
children 00d609883252
line wrap: on
line diff
--- a/gamelib/equipment.py	Fri Sep 04 20:16:51 2009 +0000
+++ b/gamelib/equipment.py	Fri Sep 04 20:23:30 2009 +0000
@@ -3,6 +3,7 @@
 import random
 import sound
 import imagecache
+import animations
 
 class Equipment(object):
     IS_EQUIPMENT = True
@@ -50,6 +51,8 @@
         """Is the potentially unlucky target actually unlucky?"""
         if hasattr(self, 'HIT_SOUND'):
             sound.play_sound(self.HIT_SOUND)
+        if hasattr(self, 'ANIMATION'):
+            gameboard.animations.append(self.ANIMATION(wielder))
         roll = random.randint(1, 100)
         base_hit = self._get_parameter('BASE_HIT', wielder)
         range_penalty = self._get_parameter('RANGE_PENALTY', wielder)
@@ -74,6 +77,8 @@
 
     CHICKEN_IMAGE_FILE = 'sprites/equip_rifle.png'
 
+    ANIMATION = animations.MuzzleFlash
+
 class Knife(Weapon):
     TYPE = "KNIFE"
     NAME = "knife"