# HG changeset patch # User Gideon Visser # Date 1315881243 25200 # Node ID 525fe7b7da8030e6dda4c2242710efa2195bd560 # Parent ce0fec120d5e7a7ff419d3da0643a5f1d37c148b Update tile orientation with booleans diff -r ce0fec120d5e -r 525fe7b7da80 mamba/level.py --- a/mamba/level.py Mon Sep 12 14:52:03 2011 +0200 +++ b/mamba/level.py Mon Sep 12 19:34:03 2011 -0700 @@ -120,37 +120,16 @@ except IndexError: return {} # The map went out of range' try: - return temp_tile == tile + return str(temp_tile) == str(tile) except KeyError: return {} # The map tile is not existing' - return self.get_bool(x, y, 'wall') - - #please note: planning on tile tuple to be -1, 0, 1 of x then y def get_tile_orientation(self, map_y, map_x, row, tile_char): - if self.is_same_tile(tile_char, map_x, map_y): - # Draw different tiles depending on neighbourhood - if not self.is_same_tile(tile_char, map_x, map_y + 1): - if self.is_same_tile(tile_char, map_x + 1, map_y) and \ - self.is_same_tile(tile_char, map_x - 1, map_y): - tile = 1, 2 - elif self.is_same_tile(tile_char, map_x + 1, map_y): - tile = 0, 2 - elif self.is_same_tile(tile_char, map_x - 1, map_y): - tile = 2, 2 - else: - tile = 3, 2 - else: - if self.is_same_tile(tile_char, map_x + 1, map_y + 1) and \ - self.is_same_tile(tile_char, map_x - 1, map_y + 1): - tile = 1, 1 - elif self.is_same_tile(tile_char, map_x + 1, map_y + 1): - tile = 0, 1 - elif self.is_same_tile(tile_char, map_x - 1, map_y + 1): - tile = 2, 1 - else: - tile = 3, 1 - return tile + same_as_top = self.is_same_tile(tile_char, map_x, map_y - 1) + same_as_right = self.is_same_tile(tile_char, map_x + 1, map_y) + same_as_bottom = self.is_same_tile(tile_char, map_x, map_y + 1) + same_as_left = self.is_same_tile(tile_char, map_x - 1, map_y) + return (same_as_top, same_as_right, same_as_bottom, same_as_left) def get_tile_size(self): return self.tile_size