• Advertisement
Sign in to follow this  

xna game problem once again pathfinding

This topic is 3874 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

how do you draw a path from one object to another object and move it to that object? just done a simple line without anything in its way. Is there a built in function like that in xna? Anthony out

Share this post


Link to post
Share on other sites
Advertisement
This kind of thing is outside the domain of XNA, but you'll most likely want to look into the A* path finding algorithm. This article hosted by GameDev is one of the better ones I've used.

Share this post


Link to post
Share on other sites
thanks for the responce actually i thought of how i can do it without that algorithm but i still dont know how. Well there is no objects in the way and my player character roates to move. All I need is for it to rotate to the point then go straight to the point. Not sure how to do that though. how can you rotate to a point then move to the point from another angle with only knowing the point of the objects coordinates? Anthony

Share this post


Link to post
Share on other sites
You use a Vector2 to hold each object's position, right? Subtract those vectors and you'll get the vector that connects them. Have your object follow that vector.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement