This is cool as heck!
This is cool as heck!
Hi, I have a little observation to do. When you click inside a polygon and the closest point outside the polygon to the mouse is outside the screen, it would be nice if the pathinding doesn't take this into consideration and redirects to the point closest to the mouse inside the screen. If it were easy to do, I think it would be a great improvement.
P.s. I have started to mount the pathfinding in my game and it continues to work great, and I never encountered any bugs yet!
Great!. Please If you don't mind sharing your pathfinding. I need it for my adventure game
That's actually quite a bit of work to do properly. I made a simple fix here though:
(there are some other very minor changes, such as updated comments that now actually match the code!)
Note that you MUST place a node wherever a polygon exits the screen:
Any wall where one or both end nodes lie outside the frame, will be ignored (exactly on the edge counts as inside).
So in the example above, walls 1>2 and 4>5 are okay, but walls 2>3 and 3>4 will be ignored.
I tried it quickly because today I had very little time, but your simple fix is better than anything I could do, and it works great!
As usual thank's a lot for everything.
@Mehrdad, i really don't understand what you mean, maybe is my english, but for my game I use MuddyMole's pathfinding, so is simply here
Sorry, I think you made another pathfinding. And maybe I'm wrong but @MuddyMole example use surface object and it's not cross-platform, right?
The only objects that are essential for it to work are Active, Array and List objects, so it should work with any and all exporters, though I personally don't have a means of testing that.
Since several people have asked me now, I've made yet another slight modification here:
The only changes are to the debug mode.
It now uses scaled & rotated actives to draw the polygon outlines, so even if you delete the Surface object (the only object in use that isn't supported by all exporters), the debug mode is still fully functional - it's just that the polygon won't be filled.
Also, if you mouseover a node, all other nodes that are directly reachable from it will be highlighted, which is handy for spotting issues (very small polygons with very acute angles can occasionally be problematic - after adding this feature, I noticed that it was possible to sail right through the Isle of Wight in previous versions, for example!).
And I have two different questions please: I need it for an adventure point and click.
1) How can use graphic left /right/up/.... for the player?
2) Is it possible "turn before walking" too?