Mercurial > skaapsteker
view skaapsteker/sprites/npcs.py @ 583:194f71cc0689
don't remove kaneda from the geisha room too early (looks weird, but fixes crash)
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sun, 10 Apr 2011 15:59:59 +0200 |
parents | 1ccb90397c4a |
children | 79a9b61e12ff |
line wrap: on
line source
from .base import NPC, BlockingNPC, PC_LAYER, notify from pygame import transform class Monk(NPC): image_dir = 'sprites/monk' animation_regexes = [ ("meditating", "monk.png"), ] class Guard(BlockingNPC): image_dir = 'sprites/guard' def update(self): if not self._me.block and self.block: self.collides_with = set([]) self.block = False super(Guard, self).update() class Hattori(BlockingNPC): image_dir = 'sprites/hattori' facings = { 'running' : (('left', None), ('right', lambda x: transform.flip(x, True, False))), 'standing' : (('left', None), ('right', lambda x: transform.flip(x, True, False))), } def update(self): if not self._me.block: self.remove() class Ichiro(BlockingNPC): image_dir = 'sprites/ichiro' facings = { 'running' : (('left', None), ('right', lambda x: transform.flip(x, True, False))), 'standing' : (('left', None), ('right', lambda x: transform.flip(x, True, False))), } def update(self): if not self._me.block: self.remove() class Kaneda(NPC): image_dir = 'sprites/kaneda' wants_updates = True animation_regexes = [ ("standing", r"^.*_standing.png$"), ] facings = { 'standing' : (('left', None), ('right', lambda x: transform.flip(x, True, False))), } def setup(self, name, world, dsm, state, present, facing=None): super(Kaneda, self).setup(name, world, dsm, state, facing) def player_action(self, player): if not self._me.present: return super(Kaneda, self).player_action(player) def update(self): super(Kaneda, self).update() if not self._me.present and self.alive and self._me.level == "tea_house": self.remove() elif self.world.missions.kumiko_disgraced and self.alive and self._me.level == 'geisha_room': self.remove() class Tetsuo(NPC): image_dir = 'sprites/tetsuo' animation_regexes = [ ("standing", r"^.*_standing.png$"), ] facings = { 'standing' : (('left', None), ('right', lambda x: transform.flip(x, True, False))), } class Kumiko(NPC): image_dir = 'sprites/geisha' animation_regexes = [ ("standing", r"^.*_01.png$"), ] collides_with = set([PC_LAYER]) def damage(self, damage): """Destroy the kimono""" if not self.world.missions.kumikos_kimono_torn: self.world.missions.kumikos_kimono_torn = True notify("Shoo, dirty fox! Oh, look what you've done" "- you've made a great big tear in my finest silk kimono." "What will the businessman think of a ragged dress like this?") class FishMonger(NPC): image_dir = 'sprites/fishmonger' animation_regexes = [ ("standing", r"^.*_standing.png$"), ] def setup(self, **opts): super(FishMonger, self).setup(**opts) self.world.missions.fishmonger_demons_killed = 0 class Maneki(NPC): image_dir = 'sprites/maneki neko' animation_regexes = [ ("standing", r"^.*_standing.png$"), ] class Actor(NPC): image_dir = 'sprites/fishmonger' animation_regexes = [ ("standing", r"^.*_standing.png$"), ] class Sasuke(NPC): image_dir = 'sprites/sasuke' def setup(self, name, world, dsm, state, present, facing=None): self._animation = 'standing' super(Sasuke, self).setup(name, world, dsm, state, facing) def update(self): if not self._me.present: self.remove() super(Sasuke, self).update() class Kitsune(NPC): image_dir = 'sprites' animation_regexes = [ ("being_evil", "boss_kitsune.png"), ]