Ignore:
Timestamp:
09/06/13 13:14:27 (8 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Phase:
public
Message:

Save door and lever state.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/level.py

    r321 r346  
    3131        self.lines = []
    3232        self.world = world
     33        self.world.level_state.setdefault(name, {})
    3334        self.basetile = 'tiles/floor.png'
    3435        self._tile_image = None
     
    9495        elif issubclass(cls, go.GameObject):
    9596            gobj = cls(space, *args)
     97            level_state = self.world.level_state[self.name]
     98            stored_state = level_state.get(name, {})
     99            should_save = bool(gobj.set_stored_state_dict(stored_state))
     100            if should_save:
     101                if name is None:
     102                    raise Exception(
     103                        "Unnamed game object wants to save state:" % (gobj,))
     104                level_state[name] = stored_state
    96105            self.drawables.append(gobj)
    97106            if gobj.overlay:
Note: See TracChangeset for help on using the changeset viewer.