#--------------------------------------------------------------------------
# ● 自动移动的更新
#--------------------------------------------------------------------------
def update_self_movement
if near_the_screen? && @stop_count > stop_count_threshold
case @move_type
when 1; move_type_random
when 2; move_type_toward_player
when 3; move_type_custom
end
end
end
#--------------------------------------------------------------------------
# ● 判定是否在画面的可视区域內
# dx : 从画面中央开始计算,左右有多少个图块。
# dy : 从画面中央开始计算,上下有多少个图块。
#--------------------------------------------------------------------------
def near_the_screen?(dx = 12, dy = 8)
ax = $game_map.adjust_x(@real_x) - Graphics.width / 2 / 32
ay = $game_map.adjust_y(@real_y) - Graphics.height / 2 / 32
ax >= -dx && ax <= dx && ay >= -dy && ay <= dy
end
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |