changeset 26:59b340afd783

added empty chests
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Mon, 22 Aug 2011 21:59:52 +0200
parents 3216ed15bcbc
children 69254db89020
files generator.py hero.py thing.py things.png
diffstat 4 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/generator.py	Mon Aug 22 21:15:45 2011 +0200
+++ b/generator.py	Mon Aug 22 21:59:52 2011 +0200
@@ -32,7 +32,7 @@
         return x1, y1
 
     def make_trash(self):
-        trash = [thing.Plant, thing.Crate]
+        trash = [thing.Plant, thing.Chest]
         for i in range(random.randint(5, 15)):
             p = self._random_place()
             if p not in self.things:
--- a/hero.py	Mon Aug 22 21:15:45 2011 +0200
+++ b/hero.py	Mon Aug 22 21:59:52 2011 +0200
@@ -14,7 +14,7 @@
 
     def __init__(self, x, y):
         super(HeroSprite, self).__init__(x, y, 'hero.png')
-        self.facing = 0
+        self.facing = 2
         self.animation = None
 
     def update(self):
@@ -46,6 +46,7 @@
 
     def anim_drop(self):
         self.depth = self.rect.midbottom[1] + 1
+        self.image = self.frames[self.facing][0]
         self.rect.move_ip(0, -15)
         for step in range(6):
             yield
--- a/thing.py	Mon Aug 22 21:15:45 2011 +0200
+++ b/thing.py	Mon Aug 22 21:59:52 2011 +0200
@@ -64,7 +64,7 @@
         self.vertical = vertical
         self.sprite = DoorSprite(self.x, self.y, self.vertical)
 
-    def hit(self):
+    def hit(self, damage=0):
         self.sprite.animation = self.sprite.anim_open()
         self.blocks = False
 
@@ -73,9 +73,14 @@
     tx, ty = 3, 0
 
 
-class Crate(Thing):
-    tx, ty = 0, 1
+class Chest(Thing):
+    tx, ty = 1, 1
     blocks = True
 
+    def hit(self, damage=0):
+        self.sprite.image = self.sprite.frames[2][self.ty]
+        self.blocks = False
+
+
 class Plant(Thing):
     tx, ty = 2, 2
Binary file things.png has changed