projects
/
erdslangetjie.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tweak window size
[erdslangetjie.git]
/
erdslangetjie
/
level.py
diff --git
a/erdslangetjie/level.py
b/erdslangetjie/level.py
index 790557179a7ba5fb6d11361887396fbad8b4896f..645a62f7678aca49f89f85a024dbaf4cc9ecd327 100644
(file)
--- a/
erdslangetjie/level.py
+++ b/
erdslangetjie/level.py
@@
-14,7
+14,10
@@
class Level(object):
def load(self, levelfile):
"""Load the level"""
self.data = []
def load(self, levelfile):
"""Load the level"""
self.data = []
- for line in levelfile.readlines():
+ # 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)
+ for line in reversed(levelfile.readlines()):
self.data.append(list(line.strip('\n')))
def load_tiles(self):
self.data.append(list(line.strip('\n')))
def load_tiles(self):
@@
-44,3
+47,16
@@
class Level(object):
def at_exit(self, pos):
return pos in self.exit_pos
def at_exit(self, pos):
return pos in self.exit_pos
+
+ def blocked(self, pos):
+ if pos[0] < 0:
+ return True
+ if pos[1] < 0:
+ return True
+ try:
+ tile = self.data[pos[1]][pos[0]]
+ except IndexError:
+ return True
+ if tile == '.':
+ return True
+ return False