Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/FortuneMaker.activity
diff options
context:
space:
mode:
authorJustin Lewis <jtl1728@rit.edu>2010-01-29 16:06:46 (GMT)
committer Justin Lewis <jtl1728@rit.edu>2010-01-29 16:06:46 (GMT)
commit638566dfc823ee1a743c3c8b94801d23f5070e8a (patch)
treeea97619d3966f4827a70e02f97f2e25e34e41c19 /FortuneMaker.activity
parent18d3356f2c3c125749d8b238f6c4d5bc24f7c194 (diff)
Fixed door add bug, wrapping boarder in negative direction
Diffstat (limited to 'FortuneMaker.activity')
-rw-r--r--FortuneMaker.activity/Dungeon.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/FortuneMaker.activity/Dungeon.py b/FortuneMaker.activity/Dungeon.py
index 6d00b73..489ec6e 100644
--- a/FortuneMaker.activity/Dungeon.py
+++ b/FortuneMaker.activity/Dungeon.py
@@ -23,15 +23,26 @@ class Dungeon:
return self.roomlist
def get_adj_room( self, room, dir ):
+ if dir == "N":
+ next_x = room._x
+ next_y = room._y-1
+ elif dir == "E":
+ next_x = room._x+1
+ next_y = room._y
+ elif dir == "S":
+ next_x = room._x
+ next_y = room._y+1
+ elif dir == "W":
+ next_x = room._x-1
+ next_y = room._y
+ else:
+ return False
+
+ if next_x < 0 or next_y < 0:
+ return False
+
try:
- if dir == "N":
- return self.roomlist[room._y-1][room._x]
- elif dir == "E":
- return self.roomlist[room._y][room._x+1]
- elif dir == "S":
- return self.roomlist[room._y+1][room._x]
- elif dir == "W":
- return self.roomlist[room._y][room._x-1]
+ return self.roomlist[next_y][next_x]
except:
return False