Changeset 319:01e98732de46 for nagslang


Ignore:
Timestamp:
Sep 6, 2013, 12:01:30 AM (7 years ago)
Author:
Stefano Rivera <stefano@…>
Branch:
default
Message:

Open bulkheads are no longer opaque to furniture

Location:
nagslang
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • nagslang/game_object.py

    r318 r319  
    163163        return True
    164164
     165    def collide_with_furniture(self, furniture):
     166        return True
     167
    165168    @classmethod
    166169    def requires(cls):
     
    309312            return False
    310313        return True
     314
     315    collide_with_furniture = collide_with_protagonist
    311316
    312317    @classmethod
  • nagslang/screens/area.py

    r313 r319  
    66
    77from nagslang.constants import (
    8     COLLISION_TYPE_WALL, COLLISION_TYPE_PLAYER, CALLBACK_COLLIDERS)
     8    COLLISION_TYPE_WALL, COLLISION_TYPE_PLAYER, CALLBACK_COLLIDERS,
     9    COLLISION_TYPE_FURNITURE)
    910from nagslang.enemies import DeadEnemy
    1011from nagslang.events import ScreenChange, DoorEvent, FireEvent, \
     
    8384        sound.stop()
    8485
    85     def _collision_pre_solve_handler(self, space, arbiter):
     86    def _player_collision_pre_solve_handler(self, space, arbiter):
    8687        gobj = arbiter.shapes[1].physicser.game_object
    8788        result = gobj.collide_with_protagonist(self.protagonist)
     
    9394        return True
    9495
     96    def _furniture_collision_pre_solve_handler(self, space, arbiter):
     97        furniture = arbiter.shapes[0].physicser.game_object
     98        gobj = arbiter.shapes[1].physicser.game_object
     99        result = gobj.collide_with_furniture(furniture)
     100        return result is not False
     101
    95102    def _add_collision_handlers(self):
    96103        for collision_type in CALLBACK_COLLIDERS:
    97104            self.space.add_collision_handler(
    98105                COLLISION_TYPE_PLAYER, collision_type,
    99                 pre_solve=self._collision_pre_solve_handler)
     106                pre_solve=self._player_collision_pre_solve_handler)
     107            self.space.add_collision_handler(
     108                COLLISION_TYPE_FURNITURE, collision_type,
     109                pre_solve=self._furniture_collision_pre_solve_handler)
    100110
    101111    def add_walls(self):
Note: See TracChangeset for help on using the changeset viewer.