Hi!
I checked this tutorial out: Corona SDK: Game Development Path Finding http://mobile.tutsplus.com/tutorials/corona/corona-sdk-game-development-path-finding/
But it gives me an error. Does this tutorial need an update or is there a better way of doing path finding?
What I’m trying to do is this: there is an n by n grid on the screen, and the user drags his finger from one point to the other. Presently what I’m doing is this:
- on began, start recording tile positions
- on move, check if it’s a new tile, record ir.
- on end, highlight path taken
But then this fails when the user lifts his finger off the grid and places it on the farther end of the grid. I was hoping that the app could make a path from the last position to the new position, which would make it smoother somehow.
Any help, suggestion, etc would be awesome.
Regards,
John
PS: here’s the error for the path finding.
[lua]Runtime error
/Users/kazuo/Desktop/mobile/path-finding/main.lua:44: bad argument #1 to ‘getn’ (table expected, got nil)
stack traceback:
[C]: ?
[C]: in function ‘getn’
/Users/kazuo/Desktop/mobile/path-finding/main.lua:44: in function ‘CalcMoves’
/Users/kazuo/Desktop/mobile/path-finding/main.lua:207: in function
?: in function <?:229>
2012-11-25 01:46:34.714 Corona Simulator[4493:707] Runtime error
/Users/kazuo/Desktop/mobile/path-finding/main.lua:44: bad argument #1 to ‘getn’ (table expected, got nil)
stack traceback:
[C]: ?
[C]: in function ‘getn’
/Users/kazuo/Desktop/mobile/path-finding/main.lua:44: in function ‘CalcMoves’
/Users/kazuo/Desktop/mobile/path-finding/main.lua:207: in function
?: in function <?:229>[/lua] [import]uid: 186198 topic_id: 33293 reply_id: 333293[/import]