Search found 5 matches

by oleosjo
Sat Jul 20, 2013 9:51 pm
Forum: Support and Development
Topic: [SOLVED] Help with Astar pathfinding
Replies: 4
Views: 3083

Re: [SOLVED] Help with Astar pathfinding

You should've posted the difference rather than new whole version, since it's pretty big and we'd have line-by-line compare them or use diff tool. Implementation is highly sub-optimal, if you gonna use that extensively make sure to omptimize that. Yeah, I plan on optimizing later. This is just the ...
by oleosjo
Sat Jul 20, 2013 8:39 pm
Forum: Support and Development
Topic: [SOLVED] Help with Astar pathfinding
Replies: 4
Views: 3083

Re: [SOLVED] Help with Astar pathfinding

I fixed it. I don't really understand how I fixed it, but I changed the pathfinding function to this: function Pathfinder:find(cx,cy,ex,ey) if ex < 1 or ey < 1 or ex > #self.nodes or ey > #self.nodes then return nil end -- init and add starting node to the open list self.nodes[cx][cy].cost = 0 self....
by oleosjo
Sat Jul 20, 2013 6:54 pm
Forum: Support and Development
Topic: [SOLVED] Help with Astar pathfinding
Replies: 4
Views: 3083

[SOLVED] Help with Astar pathfinding

Hi, I have an Astar pathfinding algorithm I'm having trouble with. It seems to find the shortest path in some instances but not in others. I don't know what I'm doing wrong. It is based heavily on http://www.policyalmanac.org/games/aStarTutorial.htm. If you run the game and click in the top right co...
by oleosjo
Sat Jul 20, 2013 6:07 pm
Forum: Support and Development
Topic: [SOLVED] attempt to index field '?' (a number value)
Replies: 3
Views: 5179

Re: attempt to index field '?' (a number value)

bartbes wrote:Perhaps it's because self.nodes[x][y] is a number, not a table, so you can't index it.

Also, please use code tags in the future, it's unreadable otherwise.
Thanks. Figured it out. I feel stupid now. haha
by oleosjo
Sat Jul 20, 2013 2:51 pm
Forum: Support and Development
Topic: [SOLVED] attempt to index field '?' (a number value)
Replies: 3
Views: 5179

[SOLVED] attempt to index field '?' (a number value)

Hello, I am attempting to index a multidimensional array and add a property to it. I'm new to implementing OOP in Lua so maybe I'm doing something wrong there? It's breaking in the for loop. It wont let me add a property like "self.nodes[x][y].cost = 1". Any help would be greatly appreciat...