示例#1
0
文件: zombie.py 项目: cjb/curveship
 def act(self, level):
     player = level.player
     dirs = util.dir_of(self.pos, player.pos)
     # Randomly try horizontal or vertical movement
     direction = random.choice(dirs)
     try:
         try:
             self.walk(direction)
         except monster.MoveBump, e:
             if e.monster == player:
                 self.attack(direction, e.monster)
     except monster.MoveError:
         pass
示例#2
0
文件: eye.py 项目: cjb/curveship
 def act(self, level):
     player = level.player
     dirs = util.dir_of(self.pos, player.pos)
     for direction in dirs:
         try:
             try:
                 self.walk(direction)
                 return
             except monster.MoveBump, e:
                 if e.monster == player:
                     self.attack(direction, e.monster)
                     return
         except monster.MoveError:
             pass