diff skaapsteker/sprites/player.py @ 336:c8fd82ff0c71

Hook up fire buttons to attack functions. Use correct check for tails. Add skeleton for projectiles.
author Simon Cross <hodgestar@gmail.com>
date Sat, 09 Apr 2011 12:29:34 +0200
parents c6552e9fc2e1
children a9d760134706
line wrap: on
line diff
--- a/skaapsteker/sprites/player.py	Sat Apr 09 12:15:19 2011 +0200
+++ b/skaapsteker/sprites/player.py	Sat Apr 09 12:29:34 2011 +0200
@@ -234,19 +234,32 @@
         elif self._me.item is not None:
             self.drop_item()
 
+    def _bite_attack(self):
+        print 'ninja bite attack'
+        self.attacking = 2
+        self._last_time = time.time() # Reset the animation clock
+
+    def _fireball_attack(self):
+        print 'ninja fireball attack attack attack'
+        self.attacking = 2
+        self._last_time = time.time() # Reset the animation clock
+
+    def _lightning_attack(self):
+        print 'thunderbolts and lightning'
+        self.attacking = 2
+        self._last_time = time.time() # Reset the animation clock
 
     def action_fire1(self):
-        # FIXME: Use the correct tail properties for this
-        if len(self._me.tails) < 2:
-            # Only have a bite attack
-            print 'attacking'
-            self.attacking = 2
-            # Reset the animation clock
-            self._last_time = time.time()
-        print "F1"
+        if "fireball" not in self._me.tails:
+            self._bite_attack()
+        else:
+            self._fireball_attack()
 
     def action_fire2(self):
-        print "F2"
+        if "lightning" not in self._me.tails:
+            self._bite_attack()
+        else:
+            self._lightning_attack()
 
     def _get_action(self):
         if self.attacking:
@@ -361,7 +374,5 @@
     def add_actionable(self, actionable):
         self._touching_actionables.append(actionable)
 
-
     def eat_aburage(self):
         self._me.tofu += 1
-