self.level = level
else:
self.level = 'levels/' + level
- self.level_obj = Level(level_data)
+ self.level_obj = Level(level_data, self.level)
level_data.close()
self.level_obj.load_tiles()
import os
from data import load_image, load, filepath
+
+from kivy.logger import Logger
+
WALL = '.'
FLOOR = ' '
ENTRY = 'E'
class Level(object):
- def __init__(self, levelfile):
+ def __init__(self, levelfile, name):
self._data = []
self.exit_pos = []
self.enter_pos = None
self._changed = []
self._gates = {}
self._buttons = {}
+ self._name = name
# Because of how kivy's coordinate system works,
# we reverse the lines so things match up between
# the file and the display (top of file == top of display)
def load_tiles(self):
"""Load the list of tiles for the level"""
+ Logger.info('%s: load tiles' % self._name)
self._tiles = []
self._gates = {}
self._buttons = {}
line = line.strip()
if os.path.exists(filepath(line)):
level_file = load(line)
- level = Level(level_file)
+ level = Level(level_file, line)
level_file.close()
try:
level.validate()