findRoute() Function Reference

findRoute(integer xFrom, integer yFrom, integer xTo, integer yTo)

Finds and returns a path between two tiles, or false if no path is possible. This differs to populateRoute() which will move a character along the found route instead of returning data.
The found route is returned as table data containing From -> To pairs. For example a route from tile 8x6 to 11x7 might look like this:
{ { xFrom = 8, yFrom = 6, xTo = 9, yTo = 6 }, { xFrom = 9, yFrom = 6, xTo = 10, yTo = 7 }, { xFrom = 10, yFrom = 7, xTo = 11, yTo = 7 } }


	local qiso = require "plugin.qisoengine"
	qiso.setAssetsFolder("assets")
	qiso.loadTiledMap("sample-tilemap")

	local routeData = qiso.findRoute(8, 6, 11, 7)
	if(routeData ~= false) then
		for i = 1, #routeData, 1 do
			print("From " .. routeData[i].xFrom .. "," .. routeData[i].yFrom .. " To " .. routeData[i].xTo .. "," .. routeData[i].yTo )
		end
	end