Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/game_map.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2012-02-07 02:59:09 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-02-07 02:59:09 (GMT)
commit2228c99764cdfcba0b735629442e99446b6bf488 (patch)
tree91a219091f91750d68a94dcb5ae4486b0db390c8 /game_map.py
parent8af5ea4b17b5ce491a035172429b81d919e22fe7 (diff)
Move the wall colors to the dictionaries of evewry room.
The idea is put al the info related to the room in this dictionary, like the name, other colors, etc. Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'game_map.py')
-rw-r--r--game_map.py29
1 files changed, 11 insertions, 18 deletions
diff --git a/game_map.py b/game_map.py
index b92ec6a..93bb2e0 100644
--- a/game_map.py
+++ b/game_map.py
@@ -37,9 +37,16 @@ class GameMap():
data = {'max_x': 4, 'max_y': 6,
- 'rooms': {'A': {}, 'B': {}, 'C': {}, 'D': {},
- 'E': {}, 'F': {}, 'G': {}, 'H': {},
- 'I': {}, 'J': {}},
+ 'rooms': {'A': {'wall_color': (0.7, 0.8, 0.7)},
+ 'B': {'wall_color': (0.8, 0.8, 0.6)},
+ 'C': {'wall_color': (0.6, 0.6, 1)},
+ 'D': {'wall_color': (0.7, 0.8, 0.7)},
+ 'E': {'wall_color': (0.8, 0.8, 0.6)},
+ 'F': {'wall_color': (0.7, 0.8, 0.7)},
+ 'G': {'wall_color': (0.3, 0.4, 0.3)},
+ 'H': {'wall_color': (0.8, 0.8, 0.6)},
+ 'I': {'wall_color': (0.7, 0.8, 0.7)},
+ 'J': {'wall_color': (0.8, 0.8, 0.6)}},
'cells': ['AAAA',
'BCCE',
@@ -48,19 +55,6 @@ class GameMap():
'FHHI',
'JJJJ'],
- 'room_colors': {
- 'A': (0.7, 0.8, 0.7),
- 'B': (0.8, 0.8, 0.6),
- 'C': (0.6, 0.6, 1),
- 'D': (0.7, 0.8, 0.7),
- 'E': (0.8, 0.8, 0.6),
- 'F': (0.7, 0.8, 0.7),
- 'G': (0.3, 0.4, 0.3),
- 'H': (0.8, 0.8, 0.6),
- 'I': (0.7, 0.8, 0.7),
- 'J': (0.8, 0.8, 0.6),
- },
-
# walls are defined by the cell position x,y and the direction
# N,S,E,W
'walls': [{'position': [0, 0, 'S'], 'objects': ['door_1']},
@@ -79,7 +73,6 @@ class GameMap():
{'position': [2, 4, 'E'], 'objects': ['door_17']},
{'position': [3, 4, 'S'], 'objects': ['door_18']}]}
-
def get_room(self, x, y):
""" Return room key and the dictionary based in
the position x,y in the map"""
@@ -168,7 +161,7 @@ class GameMap():
def get_wall_color(self, x, y):
room = self.get_room(x, y)
- return self.data['room_colors'][room]
+ return self.data['rooms'][room]['wall_color']
def go_right(self, x, y, direction):
""" Return next position if the user go to the right"""