Changeset 456:427d4a3c53d7 for nagslang


Ignore:
Timestamp:
Sep 7, 2013, 1:26:00 PM (7 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
rebase_source:
65fbc3b686788e52879f149cff5c6c8d3e9c9e5f
Message:

Better CollidePuzzler? behaviour.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/puzzle.py

    r444 r456  
    7171        self._collision_types = collision_types
    7272
    73     def get_colliders(self):
     73    def get_interior_colliders(self):
    7474        space = self.game_object.get_space()
    7575        my_shape = self.game_object.get_shape()
    7676        shapes = [shape for shape in space.shapes
    7777                  if shape.collision_type in self._collision_types]
    78         return [shape for shape in shapes
    79                 if my_shape in space.point_query(shape.body.position)]
     78        return set(shape for shape in shapes
     79                   if my_shape in space.point_query(shape.body.position))
     80
     81    def get_colliders(self):
     82        space = self.game_object.get_space()
     83        my_shape = self.game_object.get_shape()
     84        shapes = set(shape for shape in space.shape_query(my_shape)
     85                     if shape.collision_type in self._collision_types)
     86        shapes.update(self.get_interior_colliders())
     87        return shapes
    8088
    8189    def get_state(self):
Note: See TracChangeset for help on using the changeset viewer.