Changeset 519:ddd86cb25945 for nagslang


Ignore:
Timestamp:
Sep 7, 2013, 6:09:31 PM (7 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Children:
520:3f79a77ef1e3, 534:62784e479ed2
rebase_source:
8021076f4c16bed55dc4e24c513c193f947f47c1
Message:

Updated hangar.

Location:
nagslang
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • nagslang/game_object.py

    r510 r519  
    77from nagslang import puzzle
    88from nagslang import render
    9 from nagslang.mutators import FLIP_H, ImageOverlay
     9from nagslang.mutators import FLIP_H, ImageOverlay, rotator
    1010from nagslang.constants import (
    1111    COLLISION_TYPE_DOOR, COLLISION_TYPE_FURNITURE, COLLISION_TYPE_PROJECTILE,
     
    397397
    398398
     399def make_overlay_image(image_name, angle):
     400    transforms = ()
     401    if angle != 0:
     402        transforms = (rotator(-angle),)
     403    return resources.get_image('objects', image_name, transforms=transforms)
     404
     405
    399406class PuzzleDoor(BaseDoor):
    400407    def __init__(self, space, position, destination, dest_pos, angle,
    401408                 key_state):
    402409        self._key_state = key_state
    403         overlay = ImageOverlay(resources.get_image('objects', 'lock.png'))
     410        overlay = ImageOverlay(make_overlay_image('lock.png', angle))
    404411        super(PuzzleDoor, self).__init__(
    405412            space, position, destination, dest_pos, angle,
     
    440447        self._key_item = key_item
    441448        overlay = ImageOverlay(
    442             resources.get_image('objects', '%s.png' % (key_item,)))
     449            make_overlay_image('%s.png' % (key_item,), angle))
    443450        super(KeyedDoor, self).__init__(
    444451            space, position, destination, dest_pos, angle,
  • nagslang/mutators.py

    r364 r519  
    5858
    5959
     60def rotator(angle):
     61    return Mutator(rotate, angle)
     62
     63
    6064# Identity mutator
    6165NULL = Mutator(lambda x: x)
    6266
    6367# Rotation
    64 R90 = Mutator(rotate, 90)
    65 R180 = Mutator(rotate, 180)
    66 R270 = Mutator(rotate, -90)
     68R90 = rotator(90)
     69R180 = rotator(180)
     70R270 = rotator(-90)
    6771
    6872FLIP_H = Mutator(flip, True, False)
Note: See TracChangeset for help on using the changeset viewer.