changeset 38:0bc7de373079

Monster clean up
author Radomir Dopieralski <moindev@sheep.art.pl>
date Tue, 25 Dec 2007 21:50:35 +0100
parents c75bbc214c42
children 62f224d11915
files lib/monster/box.py lib/monster/crate.py lib/monster/wrench.py
diffstat 3 files changed, 34 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lib/monster/box.py	Tue Dec 25 21:48:37 2007 +0100
+++ b/lib/monster/box.py	Tue Dec 25 21:50:35 2007 +0100
@@ -8,7 +8,7 @@
 from util import *
 
 class Mob(monster.Monster):
-
+    name = "box"
     frames = read_frames(os.path.join("data", "image", "box.png"))
 
     def __init__(self, pos, level):
--- a/lib/monster/crate.py	Tue Dec 25 21:48:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-from monster import Monster
-
-class Mob(Monster):
-    name = "crate"
-    def __init__(self, pos, level):
-        Monster.__init__(self, pos, level, "box.png")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/monster/wrench.py	Tue Dec 25 21:50:35 2007 +0100
@@ -0,0 +1,33 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import random
+import os
+
+import monster
+from util import *
+
+class Mob(monster.Monster):
+    name = "wrench"
+    frames = read_frames(os.path.join("data", "image", "wrench.png"))
+
+    def __init__(self, pos, level):
+        monster.Monster.__init__(self, pos, level)
+        
+    def act(self):
+        direction = random.randint(1, 4)
+        try:
+            try:
+                self.walk(direction)
+            except monster.MoveBump, e:
+                self.attack(direction, e.monster)
+        except monster.MoveError:
+            pass
+    
+    def attack(self, direction, monster):
+        self.step = 8
+        self.anim = self.anim_attack
+        monster.hit()
+
+    def hit(self):
+        pass