Bread First Search to player

I have a question about finding a path to the player…
How should i go about this? I’m working on a separate branch.
I tried it in the pathfinder.cs in BreadthFirstSearch by setting the destinationcoordinates to the player, but I can’t get it to work. They are getting set at 0,0.

I tried in the gridmanager.cs to make some functions to GetCoordinatesFromPositionToPlayer, but I guess I’m on the wrong way.

Can somebody help me to get me in the right way? I want to do it myself, but it feels like I’m looking in the wrong places.

Hi,

What do you mean by “separate branch”?

Have you already compared your code to the Lecture Project Changes which can be found in the Resources of this lecture?

Well i meant on gitkraken, sorry. Just to be safe.

The course is done and in the course there are enemie, who walk on a path to a set destination.
I wanted to have enemies, who chase the player => calculate path on the grid to the player. Of course in update/runtime, so they don’t stand still.

My temporary solution was: I made a second Pool with enemies, who walk towards the player, but don’t use the grid. So now I have enemies who walk “clunky” (on the path) and other who chase the player on a “fluid” path (well without a path, just zooming through the map).
Yes, english isn’t my first language.

For now it’s okay.

And what’s the problem with your temporary solution? To me, it sounds fine. Is there a reason why you don’t want to keep it?


See also:

Just that the enemies don’t move the same.
But I keep it that way and i will find a reason for that :smiley:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms