Changeset 263:6c554ce627e3 for nagslang


Ignore:
Timestamp:
Sep 4, 2013, 10:38:14 PM (7 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
rebase_source:
a0bec7ee14597e8e636de69ccdf19880c95db79a
Message:

Add angle to doors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/game_object.py

    r261 r263  
    11import pymunk
    22import pymunk.pygame_util
     3
     4import math
    35
    46from nagslang import puzzle
     
    237239    zorder = ZORDER_FLOOR
    238240
    239     def __init__(self, space, position, destination, dest_pos, key_state=None):
     241    def __init__(self, space, position, destination, dest_pos, angle,
     242                 key_state=None):
    240243        body = make_body(pymunk.inf, pymunk.inf, position, damping=0.5)
    241244        self.shape = pymunk.Poly(
    242             body, [(-32, -32), (32, -32), (32, 32), (-32, 32)])
     245            body, [(-4, -30), (4, -30), (4, 30), (-4, 30)])
    243246        self.shape.collision_type = COLLISION_TYPE_DOOR
     247        self.shape.body.angle = float(angle)/180 * math.pi
    244248        self.shape.sensor = True
    245249        self.destination = destination
     
    263267        return [("name", "string"), ("position", "coordinates"),
    264268                ("destination", "level name"), ("dest_pos", "coordinate"),
    265                 ("key_state", "puzzler")]
     269                ("angle", "degrees"),
     270                ("key_state", "puzzler (optional)")]
    266271
    267272
Note: See TracChangeset for help on using the changeset viewer.