Skip to content
Snippets Groups Projects
Commit aba97d97 authored by dg's avatar dg
Browse files

fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@3919 51575b47-30f0-44d4-a5cc-537603b46e54
parent e1dc81fe
No related branches found
No related tags found
No related merge requests found
......@@ -100,12 +100,12 @@ function _M:moveDirection(x, y)
local list = coords[dir]
local l = {}
-- Find possibilities
for i = 1, #list do
for i = 1, #list do if dir_to_coord[list[i]] then
local dx, dy = self.x + dir_to_coord[list[i]][1], self.y + dir_to_coord[list[i]][2]
if self:aiCanPass(dx, dy) then
l[#l+1] = {dx,dy, (dx-x)^2 + (dy-y)^2}
end
end
end end
-- Move to closest
if #l > 0 then
table.sort(l, function(a,b) return a[3]<b[3] end)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment