changeset 256:2a0bad886956

Collision handlers get the protagonist.
author Jeremy Thurgood <firxen@gmail.com>
date Thu, 05 Sep 2013 00:06:37 +0200
parents d4928d4a661a
children c00022002c63
files nagslang/game_object.py nagslang/screens/area.py
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/nagslang/game_object.py	Thu Sep 05 00:05:03 2013 +0200
+++ b/nagslang/game_object.py	Thu Sep 05 00:06:37 2013 +0200
@@ -136,7 +136,7 @@
     def animate(self):
         self.renderer.animate()
 
-    def collide_with_protagonist(self):
+    def collide_with_protagonist(self, protagonist):
         """Called as a `pre_solve` collision callback with the protagonist.
 
         You can return `False` to ignore the collision, anything else
@@ -254,7 +254,7 @@
             puzzler,
         )
 
-    def collide_with_protagonist(self):
+    def collide_with_protagonist(self, protagonist):
         if self.puzzler.get_state():
             DoorEvent.post(self.destination, self.dest_pos)
 
@@ -282,7 +282,7 @@
             puzzler,
         )
 
-    def collide_with_protagonist(self):
+    def collide_with_protagonist(self, protagonist):
         if self.puzzler.get_state():
             # Reject the collision, we can walk through.
             return False
--- a/nagslang/screens/area.py	Thu Sep 05 00:05:03 2013 +0200
+++ b/nagslang/screens/area.py	Thu Sep 05 00:06:37 2013 +0200
@@ -83,7 +83,7 @@
 
     def _collision_pre_solve_handler(self, space, arbiter):
         gobj = arbiter.shapes[1].physicser.game_object
-        result = gobj.collide_with_protagonist()
+        result = gobj.collide_with_protagonist(self.protagonist)
         # The collision handler must return `True` or `False`. We don't want to
         # accidentally reject collisions from handlers that return `None`, so
         # we explicitly check for `False` and treate everything else as `True`.