Mercurial > dw
changeset 32:eaa6069abca6
More monster kinds
| author | Radomir Dopieralski <moindev@sheep.art.pl> |
|---|---|
| date | Fri, 21 Dec 2007 03:59:25 +0100 |
| parents | 139b5500c426 |
| children | 4cb260e5092d |
| files | data/image/wrench.png lib/monster/box.py lib/monster/brain.py lib/monster/skeleton.py lib/monster/zombie.py |
| diffstat | 5 files changed, 132 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/monster/box.py Fri Dec 21 03:59:25 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): + + frames = read_frames(os.path.join("data", "image", "box.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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/monster/brain.py Fri Dec 21 03:59:25 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): + + frames = read_frames(os.path.join("data", "image", "brain.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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/monster/skeleton.py Fri Dec 21 03:59:25 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): + + frames = read_frames(os.path.join("data", "image", "skeleton.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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/monster/zombie.py Fri Dec 21 03:59:25 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): + + frames = read_frames(os.path.join("data", "image", "zombie.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
