changeset 396:dc534c2c475c

Fix up various power activation checks.
author Simon Cross <hodgestar@gmail.com>
date Sat, 09 Apr 2011 16:41:41 +0200
parents 135cbb99511f
children 00dbc053f9a0
files skaapsteker/sprites/player.py
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/skaapsteker/sprites/player.py	Sat Apr 09 16:41:44 2011 +0200
+++ b/skaapsteker/sprites/player.py	Sat Apr 09 16:41:41 2011 +0200
@@ -36,6 +36,7 @@
         self.sprinting = 0
         self.jumping = False
         self.flying = False
+        self.prep_flight = 0.0
         self.shape = 'fox'  # Needed so load image does the right thing
         self._load_images()
         self.inventory_image = None
@@ -205,15 +206,14 @@
             self.deltav((-450.0, 0.0))
 
     def action_double_left(self):
-        # FIXME: Tie this to the tails
-        if self.sprinting > 0 or self.flying > 0:
+        if self.sprinting > 0 or self.flying > 0 or 'sprint' not in self._me.tails or self._me.shape != 'fox':
             return
         self.sprinting = 2
         self._max_sprint_time = float(len(self._me.tails)) / 4.0
         self._sprint_start_time = time.time()
 
     def action_double_right(self):
-        if self.sprinting > 0 or self.flying > 0:
+        if self.sprinting > 0 or self.flying > 0 or 'sprint' not in self._me.tails or self._me.shape != 'fox':
             return
         self.sprinting = 2
         self._max_sprint_time = float(len(self._me.tails)) / 4.0
@@ -221,7 +221,8 @@
 
     def action_double_up(self):
         if self.flying > 0 or 'flight' not in self._me.tails or \
-               self.prep_flight - time.time() > 2.5 * DOUBLE_TAP_TIME:
+               self.prep_flight - time.time() > 2.5 * DOUBLE_TAP_TIME \
+               or self._me.shape != 'fox':
             return
         self.flying = 1
         self._max_flight_time = float(len(self._me.tails))
@@ -301,7 +302,7 @@
         self._launch_projectile(Lightning)
 
     def action_fire1(self):
-        if not self.check_fire_rate():
+        if self._me.shape != 'fox' or not self.check_fire_rate():
             return
         if "fireball" not in self._me.tails:
             self._bite_attack()
@@ -309,7 +310,7 @@
             self._fireball_attack()
 
     def action_fire2(self):
-        if not self.check_fire_rate():
+        if self._me.shape != 'fox' or not self.check_fire_rate():
             return
         if "lightning" not in self._me.tails:
             self._bite_attack()