3 from data import load_image
14 def load(self, levelfile):
17 for line in levelfile.readlines():
18 self.data.append(list(line.strip('\n')))
21 """Load the list of tiles for the level"""
25 for j, line in enumerate(self.data):
27 for i, c in enumerate(line):
29 tile_line.append(load_image('tiles/floor.bmp'))
31 tile_line.append(load_image('tiles/wall.bmp'))
32 elif c == 'E' or c == 'X':
35 raise RuntimeError('Multiple entry points')
36 self.enter_pos = (i, j)
38 self.exit_pos.append((i, j))
39 tile_line.append(load_image('tiles/door.bmp'))
40 self.tiles.append(tile_line)
45 def at_exit(self, pos):
46 return pos in self.exit_pos