diff skaapsteker/sprites/projectiles.py @ 355:5bdb4677510a

Have fireballs appear in the right place.
author Simon Cross <hodgestar@gmail.com>
date Sat, 09 Apr 2011 14:02:13 +0200
parents 077f43eb4145
children 02bf05964619
line wrap: on
line diff
--- a/skaapsteker/sprites/projectiles.py	Sat Apr 09 14:01:32 2011 +0200
+++ b/skaapsteker/sprites/projectiles.py	Sat Apr 09 14:02:13 2011 +0200
@@ -19,6 +19,17 @@
             ('right', lambda x: transform.flip(x, True, False))),
     }
 
+    FIREBALL_WIDTH = 60 # pixels
+
+    def setup(self, direction):
+        self.facing = direction
+        if self.facing == "left":
+            shift = (-self.FIREBALL_WIDTH / 2, 0)
+        else:
+            shift = (self.FIREBALL_WIDTH / 2, 0)
+        self.rect.move_ip(shift)
+        self.collide_rect.move_ip(shift)
+
     def collided_player(self, player):
         print "%s went boom with player" % self