changeset 349:bc40be4ab5fc

Fix negative health bar
author Neil Muller <drnlmuller@gmail.com>
date Sat, 09 Apr 2011 13:31:57 +0200
parents 7d4738347a9c
children e1ce14caa5a3
files skaapsteker/levelscene.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/skaapsteker/levelscene.py	Sat Apr 09 13:30:44 2011 +0200
+++ b/skaapsteker/levelscene.py	Sat Apr 09 13:31:57 2011 +0200
@@ -194,7 +194,7 @@
         bar = pygame.Rect(0, 0, constants.FoxHud.HEALTH_WIDTH, constants.FoxHud.HEALTH_HEIGHT)
         bar.bottomleft = health_bottom
         pygame.draw.rect(self._level_surface, constants.FoxHud.HEALTH_BACKGROUND, bar)
-        bar.height = int(constants.FoxHud.HEALTH_HEIGHT * float(fox.cur_health)/fox.max_health)
+        bar.height = int(constants.FoxHud.HEALTH_HEIGHT * float(max(0, fox.cur_health))/fox.max_health)
         bar.bottomleft = health_bottom
         pygame.draw.rect(self._level_surface, constants.FoxHud.HEALTH_FOREGROUND, bar)