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/level.py

    r433 r437  
    2828
    2929class Level(object):
     30    _game_starting_point = None
    3031
    3132    def __init__(self, name, world):
     
    7576    @classmethod
    7677    def game_starting_point(cls):
    77         with resources.get_file('levels', 'meta') as f:
    78             data = load(f)
    79         return (data['starting_level'], data['starting_position'])
     78        if not cls._game_starting_point:
     79            with resources.get_file('levels', 'meta') as f:
     80                data = load(f)
     81            cls._game_starting_point = (data['starting_level'],
     82                                        tuple(data['starting_position']))
     83        return cls._game_starting_point
     84
     85    def is_starting_level(self):
     86        return self.name == self.game_starting_point()[0]
    8087
    8188    def load(self, space):
Note: See TracChangeset for help on using the changeset viewer.