View difference between Paste ID: dWLQr9VL and ddFBGGuC
SHOW: | | - or go back to the newest paste.
1
local function neighborInSequence(reference, lastNeighbor)
2
	local dX, dY
3
	dX, dY = lastNeighbor.xTile - reference.xTile, lastNeighbor.yTile - reference.yTile
4
	dX, dY = -dY, dX
5
	newNeighbor = reference.parent[reference.yTile + dY][reference.xTile + dX]
6
	if newNeighbor.isTraversable then
7
		costToNeighbor = 1
8
	else
9
		costToNeighbor = math.huge
10
	end
11
	return newNeighbor, costToNeighbor
12
end