Ignore:
Timestamp:
09/06/13 18:45:02 (8 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Phase:
public
Rebase:
66333461336336623964336638306331323338626330643037626137633537623838396534376235
Message:

Keycard doors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/game_object.py

    r363 r364  
    77from nagslang import puzzle
    88from nagslang import render
    9 from nagslang.mutators import FLIP_H
     9from nagslang.mutators import FLIP_H, ImageOverlay
    1010from nagslang.constants import (
    1111    COLLISION_TYPE_DOOR, COLLISION_TYPE_FURNITURE, COLLISION_TYPE_PROJECTILE,
     
    349349                 key_item=None):
    350350        self._key_item = key_item
     351        overlay = ImageOverlay(
     352            resources.get_image('objects', '%s.png' % (key_item,)))
    351353        super(KeyedDoor, self).__init__(
    352354            space, position, destination, dest_pos, angle,
    353             render.ImageRenderer(resources.get_image('objects', 'door.png')),
     355            render.ImageRenderer(resources.get_image(
     356                'objects', 'door.png', transforms=(overlay,))),
    354357            environment.ItemRequiredCondition(key_item),
    355358        )
     
    578581    def apply_effect(self, protagonist):
    579582        protagonist.force_wolf_form()
     583
     584
     585class KeyCard(CollectibleGameObject):
     586    def __init__(self, space, position, name):
     587        body = make_body(None, None, position)
     588        self.shape = pymunk.Circle(body, 20)
     589        super(KeyCard, self).__init__(
     590            space, name, self.shape,
     591            render.ImageRenderer(
     592                resources.get_image('objects', '%s.png' % (name,))),
     593        )
     594
     595    @classmethod
     596    def requires(cls):
     597        return [("name", "string"), ("position", "coordinates"),
     598                ("item_name", "string")]
Note: See TracChangeset for help on using the changeset viewer.