Mercurial > skaapsteker
diff skaapsteker/sprites/player.py @ 314:f29999d1bba6
Add inventory drawing
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Fri, 08 Apr 2011 23:29:24 +0200 |
parents | 15b2be883a40 |
children | 0fc2b9d1a9cb |
line wrap: on
line diff
--- a/skaapsteker/sprites/player.py Fri Apr 08 23:02:50 2011 +0200 +++ b/skaapsteker/sprites/player.py Fri Apr 08 23:29:24 2011 +0200 @@ -315,6 +315,15 @@ def take_item(self, item): self.take_item_by_name(item.name) + # We create a scaled version of the image for the inventory display + image = item.image + if image.get_width() > image.get_height(): + new_width = 48 + new_height = int(image.get_height() * (48.0 / image.get_width())) + else: + new_height = 48 + new_width = int(image.get_width() * (48.0 / image.get_height())) + self.inventory_image = pygame.transform.scale(image, (new_width, new_height)) item.kill() print "took", item