Why does A* path finding sometimes go in straight lines and sometimes diagonals? (Java)

Posted by Relequestual on Stack Overflow See other posts from Stack Overflow or by Relequestual
Published on 2009-07-25T16:44:51Z Indexed on 2010/05/22 22:51 UTC
Read the original article Hit count: 286

I'm in the process of developing a simple 2d grid based sim game, and have fully functional path finding.

I used the answer found in my previous question as my basis for implementing A* path finding. (http://stackoverflow.com/questions/735523/pathfinding-2d-java-game).

To show you really what I'm asking, I need to show you this video screen capture that I made. I was just testing to see how the person would move to a location and back again, and this was the result...

http://www.screenjelly.com/watch/Bd7d7pObyFo

Different choice of path depending on the direction, an unexpected result. Any ideas?

© Stack Overflow or respective owner

Related posts about java

Related posts about artificial-intelligence