Changeset 345:4708e86a9a3c


Ignore:
Timestamp:
Sep 6, 2013, 11:42:42 AM (7 years ago)
Author:
Stefano Rivera <stefano@…>
Branch:
default
Message:

Remember start position on a level (a bit hacky)

Location:
nagslang
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • nagslang/screens/area.py

    r342 r345  
    172172                self._disable_render = True
    173173                self.world.rooms += 1
    174                 self.world.level = ev.destination
     174                self.world.level = (ev.destination, ev.dest_pos)
    175175                ScreenChange.post(ev.destination)
    176176                return
  • nagslang/screens/menu.py

    r342 r345  
    4747
    4848    def play(self):
    49         ScreenChange.post(self.world.level)
     49        level_name, pos = self.world.level
     50        self.world.protagonist.set_position(pos)
     51        ScreenChange.post(level_name)
    5052
    5153    def restart(self):
  • nagslang/world.py

    r342 r345  
    2323        self.kills = 0
    2424        self.rooms = 0
    25         self.protagonist = Protagonist(pymunk.Space(), self, (350, 300))
    2625        first_level = Level.list_levels()[0]
    27         self.level = first_level
     26        starting_position = (350, 300)
     27        self.protagonist = Protagonist(pymunk.Space(), self, starting_position)
     28        self.level = (first_level, starting_position)
    2829
    2930    def _save_location(self):
Note: See TracChangeset for help on using the changeset viewer.