7 from kivy.app import App
8 from kivy.uix.widget import Widget
9 from kivy.uix.floatlayout import FloatLayout
10 from kivy.graphics import Color, Rectangle
12 from erdslangetjie.data import filepath, load
13 from erdslangetjie.level import Level
16 class GameWindow(FloatLayout):
18 def __init__(self, level):
19 super(GameWindow, self).__init__(size=(960, 960))
20 if os.path.exists(filepath(level)):
21 level_data = load(level)
23 elif os.path.exists(filepath('levels/' + level)):
24 level_data = load('levels/' + level)
25 self.level = 'levels/' + level
27 print 'Unable to find %s - treating this as a new level' % level
29 self.level_obj = Level()
30 self.level_obj.load(level_data)
35 tiles = self.level_obj.get_tiles()
38 for tile_line in tiles:
40 for tile in tile_line:
41 node = Widget(size=(tile_size, tile_size), pos=(bx, by))
44 Rectangle(pos=node.pos, size=node.size,
54 self.level = 'level1.txt'
55 super(GameApp, self).__init__()
58 game = GameWindow(self.level)
64 """ Erdslangetjie, a maze game of eluding nemesis