changeset 141:2c643ec8dc4e

pep8 & pyflakes cleanup
author Neil Muller <drnlmuller@gmail.com>
date Mon, 12 Sep 2011 14:51:02 +0200
parents 7fbeeb402685
children ce0fec120d5e
files mamba/level.py mamba/snake.py
diffstat 2 files changed, 17 insertions(+), 15 deletions(-) [+]
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
--- a/mamba/snake.py	Mon Sep 12 13:09:09 2011 +0200
+++ b/mamba/snake.py	Mon Sep 12 14:51:02 2011 +0200
@@ -78,7 +78,8 @@
             (Snake.DOWN, (mutators.DOWN,)),
             ]:
             all_muts = (self._colour_overlay,) + self._detail_mutators + muts
-            self._images[orientation] = self.load_image(self._base_image, all_muts)
+            self._images[orientation] = self.load_image(self._base_image,
+                    all_muts)
 
     def update_image(self):
         self.image = self._images[self._orientation]
@@ -96,7 +97,8 @@
 class Head(Segment):
     def __init__(self, tile_pos):
         self._eye = mutators.Overlay("tiles/common/snake/snake-head-eye-r.png")
-        self._tongue = mutators.Overlay("tiles/common/snake/snake-head-tongue-r.png")
+        self._tongue = mutators.Overlay(
+                "tiles/common/snake/snake-head-tongue-r.png")
         self._detail_mutators = (self._eye,)
         super(Head, self).__init__("snake-head-mouth-open-r", tile_pos)