Yeah, I was about to do that since yesterday, since Karai exposed his problem.Kadoba wrote:Have you considered making the grid dimensions boundless instead of static? I think it would make your library a lot more flexible and could probably be done in a few tweaks.
Actually, building the grid with indices from 1 to n was the simplest solution, when I was working on the first releases.
Thanks so much Kadoba, for pointing that out.
I shall give you some karma, once that feature is back.
PS: I am unsure about what you meant when saying "boundless", though...
What I was thinking of, yesterday, was to init the grid on the basis of the very indexes in the collision map passed. Something like:
Code: Select all
local function buildGrid(map,walkable)
local count_width, count_height = 0,0
local nodes = {}
local isWalkable
for y in pairs(map) do
nodes[y] = {}
for x in pairs(map[y]) do
isWalkable = (map[y][x] == walkable)
nodes[y][x] = Node(x,y,isWalkable))
count_width = count_width+1
end
count_height = count_height +1
end
return nodes, count_width, count_height
end