Ignore:
Timestamp:
09/07/13 16:38:40 (8 years ago)
Author:
Stefano Rivera <stefano@…>
Branch:
default
Phase:
public
Message:

Rearrange progress saving, to happen on room entrance

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/screens/area.py

    r503 r505  
    8686        self._level = Level(self.name, self.world)
    8787        self._level.load(self.space)
    88         self.game_starting_point = Level.game_starting_point()
    8988        self._drawables = Drawables()
    9089        self.add_walls()
     
    9291        self.add_protagonist()
    9392        self.add_game_objects()
     93        self.save_progress()
    9494        sound.play_music("POL-cyber-factory-short.ogg")
    9595
     
    159159        self.protagonist = self.world.protagonist
    160160        self.protagonist.change_space(self.space)
     161        self.world.rooms += 1
    161162        self._drawables.add(self.protagonist)
     163
     164    def save_progress(self):
     165        if self.name == Level.game_starting_point()[0]:
     166            return
     167        self.world.level = (self.name, (self.protagonist.physicser.position.x,
     168                                        self.protagonist.physicser.position.y))
     169        self.world.save()
    162170
    163171    def handle_event(self, ev):
     
    181189                # Go to anther screen
    182190                self._disable_render = True
    183                 self.world.rooms += 1
    184                 self.world.level = (ev.destination, ev.dest_pos)
    185                 self.world.save()
    186191                ScreenChange.post(ev.destination)
    187192                return
Note: See TracChangeset for help on using the changeset viewer.