class Game_Event < Game_Character
$事件ID的变量号 = 10
def event_toward_player
$game_variables[$事件ID的变量号] > 0 ? judge = true : judge = false
$game_map.events[$game_variables[$事件ID的变量号]] != nil ? judge = true : judge = false
sx, sy = 0, 0
sx = $game_map.events[$game_variables[$事件ID的变量号]].x - $game_player.x if judge
sy = $game_map.events[$game_variables[$事件ID的变量号]].y - $game_player.y if judge
if sx == 0 and sy == 0
return
end
abs_sx2 = sx.abs
abs_sy2 = sy.abs
if abs_sx2 == abs_sy2
rand(2) == 0 ? abs_sx2 += 1 : abs_sy2 += 1
end
if abs_sx2 > abs_sy2
sx > 0 ? move_left : move_right
if not moving? and sy != 0
sy > 0 ? move_up : move_down
end
else
sy > 0 ? move_up : move_down
if not moving? and sx != 0
sx > 0 ? move_left : move_right
end
end # if
end # def
end # class
class Game_Event < Game_Character
$事件ID的变量号 = 10
def event_toward_player
$game_variables[$事件ID的变量号] > 0 ? judge = true : judge = false
$game_map.events[$game_variables[$事件ID的变量号]] != nil ? judge = true : judge = false
sx, sy = 0, 0
sx = $game_map.events[$game_variables[$事件ID的变量号]].x - $game_player.x if judge
sy = $game_map.events[$game_variables[$事件ID的变量号]].y - $game_player.y if judge
if sx == 0 and sy == 0
return
end
abs_sx2 = sx.abs
abs_sy2 = sy.abs
if abs_sx2 == abs_sy2
rand(2) == 0 ? abs_sx2 += 1 : abs_sy2 += 1
end
if abs_sx2 > abs_sy2
sx > 0 ? move_left : move_right
if not moving? and sy != 0
sy > 0 ? move_up : move_down
end
else
sy > 0 ? move_up : move_down
if not moving? and sx != 0
sx > 0 ? move_left : move_right
end
end # if
end # def
end # class
$事件ID的变量号 = 10