コード例 #1
0
ファイル: player.py プロジェクト: ajventer/mirthless
 def moveto(self, map, x, y):
     if not isinstance(x, int) or not isinstance(y, int):
         try:
             x = int(x)
             y = int(y)
         except:
             return
     if not map.tile(x,y).canenter():
         return
     current = self.location()
     if current.get('map') and x and y:
         gamemap = GameMap(load_yaml('maps', current['map']))
         gamemap.removefromtile(current['x'], current['y'],self,'player')
     self.put('location/x', x)
     self.put('location/y', y)
     self.put('location/map', map.get_hash())
     map.addtotile(x, y, 'player', True)
     messages.warning('%s moves to %sx%s' %(self.displayname(),x, y))
     map.reveal(x, y, self.lightradius)