def move_toward_character(character)
sx = distance_x_from(character.x)
sy = distance_y_from(character.y)
if sx < 0
if sy > 0
set_direction(sx.abs > sy.abs ? 6 : 2)
else
set_direction(sx.abs > sy.abs ? 6 : 8)
end
else
if sy < 0
set_direction(sx.abs > sy.abs ? 4 : 8)
else
set_direction(sx.abs > sy.abs ? 4 : 2)
end
end
if $game_switches[1] != true
if sx.abs == 0 && sy.abs != 0
move_straight(sy > 0 ? 8 : 2)
elsif sy.abs == 0 && sx.abs != 0
move_straight(sx > 0 ? 4 : 6)
elsif
move_diagonal((sx > 0 ? 4 : 6), (sy > 0 ? 8 : 2))
end
else
if sx.abs > sy.abs
move_straight(sx > 0 ? 4 : 6)
move_straight(sy > 0 ? 8 : 2) if !@move_succeed && sy != 0
elsif sy != 0
move_straight(sy > 0 ? 8 : 2)
move_straight(sx > 0 ? 4 : 6) if !@move_succeed && sx != 0
end
end
end