changeset 405:a0aad1c66643

Tail images
author Stefano Rivera <stefano@rivera.za.net>
date Sat, 09 Apr 2011 17:09:42 +0200
parents be4c16b446f7
children 9c043be746fa
files data/icons/tail.png skaapsteker/constants.py skaapsteker/levelscene.py
diffstat 3 files changed, 18 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
Binary file data/icons/tail.png has changed
--- a/skaapsteker/constants.py	Sat Apr 09 16:41:27 2011 +0200
+++ b/skaapsteker/constants.py	Sat Apr 09 17:09:42 2011 +0200
@@ -38,7 +38,7 @@
     INVENTORY_START = 32
 
     TAIL_START = 100
-    TAIL_OFFSET = 30
+    TAIL_OFFSET = 50
     TAIL_POSITIONS = {
             'shapeshift' : TAIL_START,
             'fireball' : TAIL_START + TAIL_OFFSET,
@@ -49,7 +49,8 @@
             'steal' : TAIL_START + 6 * TAIL_OFFSET,
             'lightning' : TAIL_START + 7 * TAIL_OFFSET,
             }
-    TAILS_WIDTH = 51
+    TAILS_BG_MARGIN = 2
+    TAILS_WIDTH = 42
     TAILS_HEIGHT = 8 * TAIL_OFFSET
 
     HEALTH_BACKGROUND = pygame.Color(128, 64, 0, 128)
--- a/skaapsteker/levelscene.py	Sat Apr 09 16:41:27 2011 +0200
+++ b/skaapsteker/levelscene.py	Sat Apr 09 17:09:42 2011 +0200
@@ -40,8 +40,13 @@
         # Helper images for hud
         self._tofu = data.load_image('icons/tofu.png')
         self._scroll = data.load_image('icons/haiku-scroll.png')
-        self._tail = data.load_image('icons/tail.png')
-
+        self._tails = {}
+        for tail in constants.FoxHud.TAIL_POSITIONS.iterkeys():
+            image = data.load_image('icons/tails/%s.png' % tail)
+            grey_image = pygame.Surface(image.get_size())
+            grey_image.convert_alpha(pygame.Surface((0, 0), 0, 8))
+            grey_image.blit(image, (0, 0))
+            self._tails[tail] = (grey_image, image)
 
         for sprite in self._level.sprites:
             self._world.add(sprite)
@@ -223,21 +228,22 @@
             self._level_surface.blit(self._player.inventory_image, inv_pos)
 
         # Tail bg
-        bgsurf = pygame.Surface((self._tail.get_size()[0] + 2 * fox_hud.BG_MARGIN,
-                                 fox_hud.TAILS_HEIGHT + fox_hud.BG_MARGIN),
+        bgsurf = pygame.Surface((fox_hud.TAILS_WIDTH + 2 * fox_hud.TAILS_BG_MARGIN,
+                                 fox_hud.TAILS_HEIGHT + 2 * fox_hud.TAILS_BG_MARGIN),
                                 flags=SRCALPHA)
         bgsurf.fill((255, 255, 255, fox_hud.BG_ALPHA))
         self._level_surface.blit(bgsurf,
                                  (self._clip_rect.left,
                                   self._clip_rect.top
                                   + fox_hud.TAIL_START
-                                  - fox_hud.BG_MARGIN))
+                                  - fox_hud.TAILS_BG_MARGIN))
 
         # Draw tails
-        # FIXME: Use correct tail icon
-        for tail in fox.tails:
-            tail_pos = self._clip_rect.left + 8, self._clip_rect.top + fox_hud.TAIL_POSITIONS[tail]
-            self._level_surface.blit(self._tail, tail_pos)
+        for tail, position in constants.FoxHud.TAIL_POSITIONS.iteritems():
+            has_tail = tail in fox.tails
+            tail_pos = (self._clip_rect.left + fox_hud.TAILS_BG_MARGIN,
+                        self._clip_rect.top + fox_hud.TAIL_POSITIONS[tail])
+            self._level_surface.blit(self._tails[tail][int(has_tail)], tail_pos)
 
         # Draw the health bar
         health_bottom = self._clip_rect.right - 30, self._clip_rect.top + 200