Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

How would I go about finding the fastest path to connect two points on a grid? I'm making a 2D game and the map is based around a grid.

I need to be able to account for any blocked tiles that the path need be able to go through.

Example: http://imgur.com/BbtnR
The blue line being what I need to figure out, and the red tiles being the blocked tiles.

Where should I start? Any advice be would great!

share|improve this question

1 Answer 1

up vote 8 down vote accepted

Sounds like you want A-star path-finding, which is pretty much the defacto for path-finding. I used this in my XNA game: http://www.csharpcity.com/reusable-code/a-path-finding-library/ (I repackaged the library into a slightly more usable stand-alone DLL).

share|improve this answer
    
This looks exactly like what i need. Thanks for the quick reply. :) –  Milkboat Mar 6 '12 at 2:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.