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 18:20:48 (GMT)
committer Justin Lewis <jtl1728@rit.edu>2010-01-29 18:20:48 (GMT)
commitfb37d173635d375d8af8ff68b54e3b5c639a1f38 (patch)
tree3d33b9f120c5d9d408e77de7840578fda3ef812a /FortuneMaker.activity
parentc9a1d5397b7b60477b406c55cc261f27298fe9dd (diff)
Fixed bug introduced by resizing grid
Diffstat (limited to 'FortuneMaker.activity')
-rw-r--r--FortuneMaker.activity/FortuneMaker.py12
-rw-r--r--FortuneMaker.activity/Room.py15
2 files changed, 17 insertions, 10 deletions
diff --git a/FortuneMaker.activity/FortuneMaker.py b/FortuneMaker.activity/FortuneMaker.py
index c86ff80..9c3500d 100644
--- a/FortuneMaker.activity/FortuneMaker.py
+++ b/FortuneMaker.activity/FortuneMaker.py
@@ -881,16 +881,8 @@ class FortuneMaker(Activity):
elif but.track_mode == 'DOOR':
- if event.x < 30 and event.y > 30 and event.y < 70:
- door_pos = "W"
- elif event.x > 70 and event.y > 30 and event.y < 70:
- door_pos = "E"
- elif event.y < 30 and event.x > 30 and event.x < 70:
- door_pos = "N"
- elif event.y > 70 and event.x > 30 and event.x < 70:
- door_pos = "S"
- else:
- #self._alert("NONE", "%d, %d"%(event.x, event.y))
+ door_pos = room.get_door_from_click( event.x, event.y )
+ if not door_pos:
return
if but.track_flag == '0':
diff --git a/FortuneMaker.activity/Room.py b/FortuneMaker.activity/Room.py
index 8557cea..928146e 100644
--- a/FortuneMaker.activity/Room.py
+++ b/FortuneMaker.activity/Room.py
@@ -158,6 +158,21 @@ class Room:
def not_empty_room(self):
return self.has_doors or self.has_enemy or self.has_item
+ def get_door_from_click(self, x, y):
+ size_offset = ROOM_SIZE / 3
+ size_uoffset = ROOM_SIZE - size_offset
+ if x < size_offset and y > size_offset and y < size_uoffset:
+ door_pos = "W"
+ elif x > size_uoffset and y > size_offset and y < size_uoffset:
+ door_pos = "E"
+ elif y < size_offset and x > size_offset and x < size_uoffset:
+ door_pos = "N"
+ elif y > size_uoffset and x > size_offset and x < size_uoffset:
+ door_pos = "S"
+ else:
+ return False
+ return door_pos
+
def render_room(self):
def expose_handler(widget, event):
w, h = widget.window.get_size()