3 from data import load_image
14 def load(self, levelfile):
17 # Because of how kivy's coordinate system works,
18 # we reverse the lines so things match up between
19 # the file and the display (top of file == top of display)
20 for line in reversed(levelfile.readlines()):
21 self.data.append(list(line.strip('\n')))
24 """Load the list of tiles for the level"""
28 for j, line in enumerate(self.data):
30 for i, c in enumerate(line):
32 tile_line.append(load_image('tiles/floor.bmp'))
34 tile_line.append(load_image('tiles/wall.bmp'))
35 elif c == 'E' or c == 'X':
38 raise RuntimeError('Multiple entry points')
39 self.enter_pos = (i, j)
41 self.exit_pos.append((i, j))
42 tile_line.append(load_image('tiles/door.bmp'))
43 self.tiles.append(tile_line)
48 def at_exit(self, pos):
49 return pos in self.exit_pos
51 def blocked(self, pos):
57 tile = self.data[pos[1]][pos[0]]