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

Replace menu and death screen with the starting level

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/screens/area.py

    r406 r437  
    99    COLLISION_TYPE_FURNITURE, COLLISION_TYPE_WEREWOLF_ATTACK,
    1010    CMD_TOGGLE_FORM, CMD_ACTION)
    11 from nagslang.events import ScreenChange, DoorEvent
     11from nagslang.events import ScreenChange, DoorEvent, QuitEvent
    1212from nagslang.level import Level
    1313from nagslang.screens.base import Screen
     
    8585        self._level = Level(self.name, self.world)
    8686        self._level.load(self.space)
     87        self.game_starting_point = Level.game_starting_point()
    8788        self._drawables = Drawables()
    8889        self.add_walls()
     
    162163        if ev.type == pygame.locals.KEYDOWN:
    163164            if ev.key == pygame.locals.K_ESCAPE:
    164                 ScreenChange.post('menu')
     165                if self._level.is_starting_level():
     166                    QuitEvent.post()
     167                    return
     168                room, pos = self.game_starting_point
     169                self.world.load()
     170                self.world.deaths += 1
     171                ScreenChange.post(room)
     172                self.protagonist.set_position(pos)
     173                self._disable_render = True
     174                return
    165175            cmd_key = self.keys.get_command_key(ev.key)
    166176            if cmd_key is not None:
Note: See TracChangeset for help on using the changeset viewer.