Changeset 569:f735665c359e for nagslang


Ignore:
Timestamp:
Sep 7, 2013, 8:39:16 PM (7 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
rebase_source:
c6ae4441f40dae60a3aa280eb8a48367a3e37322
Message:

Only save state when PuzzleDoor? is activated, not on update.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/game_object.py

    r567 r569  
    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
Note: See TracChangeset for help on using the changeset viewer.