Changeset 585:eb7909b354cd for nagslang


Ignore:
Timestamp:
Sep 7, 2013, 9:13:35 PM (7 years ago)
Author:
David Sharpe <decoydavid@…>
Branch:
default
Children:
586:dc4eeb8547dd, 593:0279d573ef7e
Parents:
584:6d2f6fcd914d (diff), 583:ea9e489315f7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • nagslang/game_object.py

    r575 r585  
    362362class SokoBox(GameObject):
    363363    def __init__(self, space, position):
    364         body = make_body(1, pymunk.inf, position, 0.2)
     364        body = make_body(1, pymunk.inf, position, 0.1)
    365365        self.shape = pymunk.Poly(
    366366            body, [(-40, -40), (40, -40), (40, 40), (-40, 40)])
    367         self.shape.friction = 0.5
     367        self.shape.friction = 2.0
    368368        self.shape.collision_type = COLLISION_TYPE_FURNITURE
    369369        super(SokoBox, self).__init__(
  • nagslang/game_object.py

    r584 r585  
    401401
    402402    def _post_door_event(self, protagonist):
     403        self.door_opened()
    403404        DoorEvent.post(self.destination, self.dest_pos)
     405
     406    def door_opened(self):
     407        pass
    404408
    405409
     
    459463    @property
    460464    def is_open(self):
    461         return self._stored_state['is_open']
     465        if self._stored_state['is_open']:
     466            return True
     467        return self.puzzler.glue.get_state_of(self._key_state)
     468
     469    def door_opened(self):
     470        self._stored_state['is_open'] = True
    462471
    463472    def set_stored_state_dict(self, stored_state):
     
    465474        self._stored_state.setdefault('is_open', False)
    466475        return True
    467 
    468     def update(self, dt):
    469         if not self.is_open:
    470             self._stored_state['is_open'] = self.puzzler.glue.get_state_of(
    471                 self._key_state)
    472         super(PuzzleDoor, self).update(dt)
    473476
    474477    @classmethod
     
    529532        return [("name", "string"), ("end1", "coordinates"),
    530533                ("end2", "coordinates"), ("key_state", "puzzler")]
     534
     535    # The level knows that bulkheads are magical
     536    @classmethod
     537    def movable(cls):
     538        return True
    531539
    532540
     
    742750    def apply_effect(self, object_to_move):
    743751        movement = self.physicser.position - object_to_move.physicser.position
    744         local_force = self.force * (1 - (self._radius / movement.length))
     752        local_force = self.force * math.sqrt(
     753            object_to_move.get_shape().body.mass)
    745754        movement.length = local_force
    746         object_to_move.environmental_movement(-movement)
    747 
    748     @classmethod
    749     def requires(cls):
    750         return [("name", "string"), ("position", "coordinates"),
    751                 ("outline", "polygon (convex)")]
     755        object_to_move.environmental_movement(movement)
     756
     757    @classmethod
     758    def requires(cls):
     759        return [("name", "string"), ("position", "coordinates"),
     760                ("radius", "int"), ("force", "int")]
    752761
    753762
Note: See TracChangeset for help on using the changeset viewer.