下面的脚本添加在scene_map的def update 下,在游戏中1~10号事件有可能行走图为空白,如果我在这段脚本里加了一句next if ,那么如果循环到空白行走图的事件next if 下面一整段是否就不会执行了? 从而因为跳过不需要判断的空白事件效率会有所提高?
if $game_switches[405] == true and $game_switches[20] == false
for j in 1..10
next if $game_map.events[j].character_name == ""
a = $game_map.events[11].screen_x
b = $game_map.events[j].screen_x
c = $game_map.events[11].screen_y
d = $game_map.events[j].screen_y
if $game_map.events[11].direction == 4
if a-b <= 40 and a-b > 0 and (c-d).abs <= 24
$game_switches[405] = false
$game_map.events[j].animation_id = 300
if $game_map.events[j].x < $game_map.events[11].x
$game_map.events[j].turn_right
else
$game_map.events[j].turn_left
end
$game_map.events[j].move_backward
$game_map.need_refresh = true
$game_map.events[j].damage = 86
$game_map.events[j].critical = false
$game_map.events[j].damage_pop = true
end
end
end
end作者: 兔毛鹿 时间: 2013-3-28 11:22
怎么办啊怎么办作者: 亿万星辰 时间: 2013-3-28 15:11
嗯,是这样的~
貌似是个ARPG的伤害处理~
if a-b <= 40 and a-b > 0 and (c-d).abs <= 24
既然屏幕上的水平距离是小于等于40大于0的,那么
if $game_map.events[j].x < $game_map.events[11].x
这个判断的意义似乎不太大啊~作者: 兔毛鹿 时间: 2013-3-29 10:19