Mercurial > mamba
diff mamba/level.py @ 141:2c643ec8dc4e
pep8 & pyflakes cleanup
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Mon, 12 Sep 2011 14:51:02 +0200 |
parents | 00ada2e29798 |
children | 525fe7b7da80 |
line wrap: on
line diff
--- a/mamba/level.py Mon Sep 12 13:09:09 2011 +0200 +++ b/mamba/level.py Mon Sep 12 14:51:02 2011 +0200 @@ -101,7 +101,8 @@ raise InvalidMapError("Map not rectangular.") tile_row = [] for x, tile_char in enumerate(row): - tile_orientation = self.get_tile_orientation(y, x, row, tile_char) + #tile_orientation = self.get_tile_orientation(y, x, row, + # tile_char) tile = self.tileset.get_tile(tile_char, (x, y), self.sprites) tile_row.append(tile) if isinstance(tile, EntrySprite): @@ -112,41 +113,40 @@ if self.entry is None: raise InvalidMapError("Not enough entry points.") - def is_same_tile(self, tile, x, y): """Is there a tile of the same type?""" try: temp_tile = self.tiles_ascii[y][x] except IndexError: - return {}#'The map went out of range' + return {} # The map went out of range' try: return temp_tile == tile except KeyError: - return {}#'The map tile is not existing' + 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): - #print "y: ", map_y, " x: ", map_x, " row: ", row, " tile_char: ", tile_char - #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): # + 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): + 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): + 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): + 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): + 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): + elif self.is_same_tile(tile_char, map_x - 1, map_y + 1): tile = 2, 1 else: tile = 3, 1