diff mamba/snake.py @ 261:d0ed88799c44

mutation indicators
author Adrianna Pińska <adrianna.pinska@gmail.com>
date Thu, 15 Sep 2011 02:21:34 +0200
parents 59166ae6e864
children 9f3b4e16372e
line wrap: on
line diff
--- a/mamba/snake.py	Thu Sep 15 01:50:50 2011 +0200
+++ b/mamba/snake.py	Thu Sep 15 02:21:34 2011 +0200
@@ -116,6 +116,7 @@
 
     def mutate(self, mutation):
         self.mutation = mutation
+        self.tail.show_mutation(mutation)
 
     def can_swim(self):
         return self.mutation == 'amphibious'
@@ -295,5 +296,15 @@
 
 
 class Tail(Segment):
+    INDICATORS = {
+        "flame-retardant": mutators.Overlay("snake/snake-tail-fire"),
+        "amphibious": mutators.Overlay("snake/snake-tail-puddle"),
+    }
+
     def __init__(self, tile_pos):
         super(Tail, self).__init__("snake-tail", tile_pos)
+
+    def show_mutation(self, mutation):
+        self._detail_mutators = (self.INDICATORS[mutation],)
+        self.make_images()
+        self.update_image()