changeset 610:29d67c51fd33

Better KeyedHatch.
author Jeremy Thurgood <firxen@gmail.com>
date Sun, 08 Sep 2013 00:39:41 +0200
parents 9ea26b835271
children c7411c70fe0e
files nagslang/game_object.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/nagslang/game_object.py	Sun Sep 08 00:32:32 2013 +0200
+++ b/nagslang/game_object.py	Sun Sep 08 00:39:41 2013 +0200
@@ -107,6 +107,8 @@
         self._shape = shape
         self._extra_shapes = extra_shapes
         shape.physicser = self
+        for es in extra_shapes:
+            es.physicser = self
 
     def get_shape(self):
         return self._shape
@@ -561,9 +563,12 @@
             body, body.world_to_local(tuple(end1)),
             body.world_to_local(tuple(end2)), 7)
         self.shape.collision_type = COLLISION_TYPE_DOOR
+        other_shape = pymunk.Circle(body, 30)
+        other_shape.collision_type = COLLISION_TYPE_DOOR
+        other_shape.sensor = True
         self._key_item = key_item
         super(KeyedHatch, self).__init__(
-            SingleShapePhysicser(space, self.shape),
+            MultiShapePhysicser(space, self.shape, other_shape),
             render.KeyedHatchRenderer(
                 resources.get_image(
                     'objects', '%s.png' % (key_item,),