Mercurial > mamba
changeset 143:525fe7b7da80
Update tile orientation with booleans
author | Gideon Visser <gideon@gideonvisser.com> |
---|---|
date | Mon, 12 Sep 2011 19:34:03 -0700 |
parents | ce0fec120d5e |
children | b292370c4548 |
files | mamba/level.py |
diffstat | 1 files changed, 6 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- 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