diff mamba/snake.py @ 199:986e72d2cb4d

Rejiggered entrances and shifted directions around.
author Jeremy Thurgood <firxen@gmail.com>
date Wed, 14 Sep 2011 19:48:20 +0200
parents 2876658d0b98
children 78f9cafb0819
line wrap: on
line diff
--- a/mamba/snake.py	Wed Sep 14 19:29:15 2011 +0200
+++ b/mamba/snake.py	Wed Sep 14 19:48:20 2011 +0200
@@ -2,7 +2,7 @@
 
 from pygame.sprite import Group, spritecollide
 
-from mamba.constants import TILE_SIZE
+from mamba.constants import TILE_SIZE, UP, DOWN, LEFT, RIGHT
 from mamba.sprites import BaseSprite
 from mamba.engine import SnakeDiedEvent
 from mamba import mutators
@@ -10,8 +10,6 @@
 
 class Snake(object):
 
-    UP, DOWN, LEFT, RIGHT = [(0, -1), (0, 1), (-1, 0), (1, 0)]
-
     def __init__(self, tile_pos, orientation):
         self.segments = self.create_segments(tile_pos, orientation)
         self.segment_group = Group()
@@ -91,7 +89,7 @@
         super(Segment, self).__init__()
         self.set_base_image(image_name)
         self._colour_overlay = self.GREEN
-        self.orientation = Snake.UP
+        self.orientation = UP
 
         self.make_images()
         self.update_image()
@@ -113,10 +111,10 @@
     def make_images(self):
         self._images = {}
         for orientation, muts in [
-            (Snake.RIGHT, (mutators.RIGHT,)),
-            (Snake.LEFT, (mutators.LEFT,)),
-            (Snake.UP, (mutators.UP,)),
-            (Snake.DOWN, (mutators.DOWN,)),
+            (RIGHT, (mutators.RIGHT,)),
+            (LEFT, (mutators.LEFT,)),
+            (UP, (mutators.UP,)),
+            (DOWN, (mutators.DOWN,)),
             ]:
             all_muts = (self._colour_overlay,) + self._detail_mutators + muts
             self._images[orientation] = self.load_image(self._base_image,