Changeset 548:b0c5f032eb9d for nagslang


Ignore:
Timestamp:
Sep 7, 2013, 7:48:42 PM (7 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
rebase_source:
e13d90216d40c740713cd639e5a74ebe6e197ee5
Message:

Tweak terrain render creation logic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/game_object.py

    r521 r548  
    627627        self.shape.collision_type = COLLISION_TYPE_SWITCH
    628628        self.shape.sensor = True
     629        renderer = self._fix_image(outline)
     630        super(HostileTerrain, self).__init__(
     631            SingleShapePhysicser(space, self.shape),
     632            renderer)
     633
     634    def _fix_image(self, outline):
    629635        if len(self.tiles) > 1:
    630636            tile_images = [resources.get_image('tiles', x)
     
    637643            renderer = render.TiledRenderer(outline, tile_image,
    638644                                            self.tile_alpha)
    639         super(HostileTerrain, self).__init__(
    640             SingleShapePhysicser(space, self.shape),
    641             renderer)
     645        return renderer
     646
     647    def update_image(self, new_outline):
     648        self.renderer = self._fix_image(new_outline)
    642649
    643650    def collide_with_protagonist(self, protagonist):
Note: See TracChangeset for help on using the changeset viewer.