Hi guys,
I've just got the pathfinding object working, but there's two problems:
First, after clicking around a few times on the screen, with the main guy following ok, the whole thing freezes. This seems to be the pathfinding object calculating a path, because sometimes it unfreezes, but usually not. Is there anything wrong I'm doing?
Second, it seems to sometimes take some crazy routes. Is this avoidable?
Here's my code to show you what I'm doing: http://www.geocities.com/mcalphabet/b.zip
Cheers.
Edited by the Author.
Possibly the reason is because my start and destination points are always changing, and it can't handle it after a while. Problem is, I need it to do that, because otehrwise it doesn't work properly...
the grid object isnt really very different in the way you use it, and it even has a decent help file included.
the main difference is that you have one expression (evaluate path) that sets the start & destination points, and searches for a path, instead of 3 separate ones. the string you use is just a unique name to let you store several paths at once.
if you want to make obstacles you use the "define map tile" condition and set the weight to a number higher than the one you specify as the "impassable weight" when you evaluate a path.
if you can use the pathfinding extension you shouldnt have any trouble with the grid one. i've always found it pretty stable for what i've been trying to do (check the help though cos some features arent available as its only a beta). not sure if there are any examples - i know there i spent ages looking in vain for them myself when i was experimenting with it, but that was a long time ago. i might try and redo yours using the grid instead if i get time (no promises though).
i've tested my "fix" some more, and i still cant get it to crash or behave erratically - no idea why it doesnt work on yours (and i have a seriously slow pc so i dont think its anything to do with that).
n/a
Assault Andy Administrator
I make other people create vaporware
Registered 29/07/2002
Points 5686
26th February, 2005 at 20:17:55 -
The example you gave SpaceCadet still seems to glitch sometimes. The object will take an extremely long route and then go diagonally for some reason. I can't see why though.
I've stuck in the grid object - problem now is, whenever i click on somewhere, my object just gets sent to 0,0. I'm sure it's something obvious i've forgotten. Here's my code:
http://www.geocities.com/mcalphabet/b3.zip