Project1
标题:
帮忙SLG寻路代码
[打印本页]
作者:
虾米£浪子
时间:
2012-9-30 16:45
标题:
帮忙SLG寻路代码
def find_next_point(x, y, r)
return if !@path_hash[[x, y, r]].nil?
@path << [x, y] if(
[email protected]
?([x, y]))
@path_hash[[x, y]] = true
find_next_point(x - 1,y, r - 1) if r > 0 && @coordinate[x-1,y] == 0
find_next_point(x + 1,y, r - 1) if r > 0 && @coordinate[x+1,y] == 0
find_next_point( x,y + 1, r - 1) if r > 0 && @coordinate[x,y+1] == 0
find_next_point( x,y - 1, r - 1) if r > 0 && @coordinate[x,y-1] == 0
end
这个是移动范围,但是寻路计算不出来.求教
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1