Ignore:
Timestamp:
09/02/13 21:05:25 (8 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Phase:
public
Message:

Load game objects from level.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/game_object.py

    r143 r145  
    1717
    1818    def add_component(self, name, puzzler):
     19        if not isinstance(puzzler, Puzzler):
     20            puzzler = puzzler.puzzler
    1921        self._components[name] = puzzler
    2022        puzzler.set_glue(self)
     
    277279def make_body(mass, moment, position, damping=None):
    278280    body = pymunk.Body(mass, moment)
    279     body.position = position
     281    body.position = tuple(position)
    280282    if damping is not None:
    281283        body.damping = damping
     
    322324class FloorSwitch(GameObject):
    323325    def __init__(self, space, position):
    324         body = pymunk.Body()
    325         body.position = position
     326        body = make_body(None, None, position)
    326327        self.shape = pymunk.Circle(body, 30)
    327328        self.shape.collision_type = COLLISION_TYPE_SWITCH
     
    336337class FloorLight(GameObject):
    337338    def __init__(self, space, position, state_source):
    338         body = pymunk.Body()
    339         body.position = position
     339        body = make_body(None, None, position)
    340340        self.shape = pymunk.Circle(body, 10)
    341341        self.shape.collision_type = COLLISION_TYPE_SWITCH
Note: See TracChangeset for help on using the changeset viewer.