-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Move to 'within range' of target #75
Comments
This is possible with the existing implementation. Simply find the desired path and walk it until you reach the desired distance, no? |
No because if the destination is an impassable tile easystar returns no path, unless i'm missing something? |
Hmm ok. I see the problem now. It won't work for cases like this either, even if E is passable. [S][0][0][0][0]
[0][0][0][0][0]
[0][1][1][1][0]
[0][1][E][1][0]
[0][1][1][1][0]
[0][0][0][0][0]
[0][0][0][0][0]
S = start
E = end
0 = passable
1 = impassable It's possible to do this now by modifying the grid between calling |
Yes, you've got it exactly right. With the current code I was looking at:
Which is a bit of a hack but it should work. Passing in the intended distance would be perfect! |
Another option would be to return the best path regardless of if the path reached the destination, and have the path have a property to note if it finished or not. That way, authors can choose to either use the path to get as far as possible, or discard the path and not move. This would work for all the scenarios above such as: |
Not to be one of those people, but I really +1 on @mikeparker second idea of allowing unclosed paths. |
For example, if my player clicks on a rock, I want him to path to next to the rock.
Similarly for my ranged enemies (who can fire lets say 4 tiles distance), I want them to path to 4 squares away.
I coded a similar thing for a C# A* algorithm and I think it was possible purely through an early abort if the path reached the distance required, no pathfinding changes needed.
The text was updated successfully, but these errors were encountered: