def move_left(turn_enabled = true)
    # 面向左
    if turn_enabled
      turn_left
    end
    # 可以通行的情況下
    if passable?(@x, @y, 4)
      # 面向左
      turn_left
      # 更新座標
      @x -= 1
      # 增加步數
      increase_steps
      move_toward_npc
    # 不能通行的情況下
    else
      # 接觸事件的啟動判定
      check_event_trigger_touch(@x-1, @y)
    end
  end
def move_left(turn_enabled = true)
    # 面向左
    if turn_enabled
      turn_left
    end
    # 可以通行的情況下
    if passable?(@x, @y, 4)
      # 面向左
      turn_left
      # 更新座標
      @x -= 1
      # 增加步數
      increase_steps
      move_toward_npc
    # 不能通行的情況下
    else
      # 接觸事件的啟動判定
      check_event_trigger_touch(@x-1, @y)
    end
  end
# ● 接近NPC
  #--------------------------------------------------------------------------
  def move_toward_npc
    nsx = []
    nsy = []
    tsx = []
    tsy = []
    nxy = []
    #p $game_map.events[1]
    for i in 1..$game_map.events.id.size-1
    nsx.push(@x.abs - $game_map.events[i].x.abs)
    nsy.push(@y.abs - $game_map.events[i].y.abs)
    tsx.push($game_map.events[i].x)
    tsy.push($game_map.events[i].y)
  end
    for i in 0..nsx.size-1
    nxy.push(nsx[i]+nsy[i])
  end
    for i in 0..nxy.size-1
    if nxy[i] == nxy.min
    #npcxy = i
    tnpcx = tsx[i]
    tnpcy = tsy[i]
    break
    end
    end
    # 求得与npc的坐标差
    sx = @x - tnpcx
    sy = @y - tnpcy
    #p tnpcy
    # 坐标相等情况下
    if sx == 0 and sy == 0
      return
    end
    # 求得差的绝对值
    abs_sx = sx.abs
    abs_sy = sy.abs
    # 横距离与纵距离相等的情况下
    if abs_sx == abs_sy
      # 随机将边数增加 1
      rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
    end
    # 横侧距离长的情况下
    if abs_sx <= 2
      # 左右方向优先。向NPC移动
      sx > 0 ? move_left : move_right
      if not moving? and sy != 0
        sy > 0 ? move_up : move_down
      end
    # 竖侧距离长的情况下
    elsif abs_sy <= 2
      # 上下方向优先。向NPC移动
      sy > 0 ? move_up : move_down
      if not moving? and sx != 0
        sx > 0 ? move_left : move_right
      end
    end
  end
# ● 接近NPC
  #--------------------------------------------------------------------------
  def move_toward_npc
    nsx = []
    nsy = []
    tsx = []
    tsy = []
    nxy = []
    #p $game_map.events[1]
    for i in 1..$game_map.events.id.size-1
    nsx.push(@x.abs - $game_map.events[i].x.abs)
    nsy.push(@y.abs - $game_map.events[i].y.abs)
    tsx.push($game_map.events[i].x)
    tsy.push($game_map.events[i].y)
  end
    for i in 0..nsx.size-1
    nxy.push(nsx[i]+nsy[i])
  end
    for i in 0..nxy.size-1
    if nxy[i] == nxy.min
    #npcxy = i
    tnpcx = tsx[i]
    tnpcy = tsy[i]
    break
    end
    end
    # 求得与npc的坐标差
    sx = @x - tnpcx
    sy = @y - tnpcy
    #p tnpcy
    # 坐标相等情况下
    if sx == 0 and sy == 0
      return
    end
    # 求得差的绝对值
    abs_sx = sx.abs
    abs_sy = sy.abs
    # 横距离与纵距离相等的情况下
    if abs_sx == abs_sy
      # 随机将边数增加 1
      rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
    end
    # 横侧距离长的情况下
    if abs_sx <= 2
      # 左右方向优先。向NPC移动
      sx > 0 ? move_left : move_right
      if not moving? and sy != 0
        sy > 0 ? move_up : move_down
      end
    # 竖侧距离长的情况下
    elsif abs_sy <= 2
      # 上下方向优先。向NPC移动
      sy > 0 ? move_up : move_down
      if not moving? and sx != 0
        sx > 0 ? move_left : move_right
      end
    end
  end