Changeset 548:b0c5f032eb9d


Ignore:
Timestamp:
09/07/13 19:48:42 (8 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
Phase:
public
Rebase:
65313364393032313664343063373430373133636436333965356137346562653665313937656535
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.