+1 vote

Hello! I am creating a tactical grid based game using AStar. The player will move to a certain grid square that has been clicked on. The player only has a limited amount of steps per turn and the amount of walkable steps (as well as the AStar) will update dynamically based on how many steps the player has taken.

My goal is to visualize the steps the player can take. My current issue is:

If there is a set of walkable tiles "around" a corner, where these connections are not made, the player should not be able to walk there.

Here is a visual example of my issue:

I have leveraged an existing script from GDQuest (awesome work guys!) that allows me to skip over obstacles when drawing out these walkable tiles, however, once I check for tiles that don't have connections (using astarnode.getpointpath(playerindex, pointrelativeindex) I get this result:


I got very excited at this result, as it seemed to remove the highlighted tiles that were not connected. However, it removed one that does seem to be connected. Something similar happens when I move the player up a few tiles:


Hopefully this illustrates the issue I am having. I have also supplied a gist of the most important functions in this code, but can paste more if needed! Thank you for any help, ideas or suggestions!

Here is the code I am using (again, thank you GDQuest for posting the template I am basing this off of :)) The place where I am setting the "visiliby walkable tiles" is line 73.


in Engine by (13 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.