Example

4 Directional A* Pathfinding Test

4

nousername010 2020-08-22 01:16 (Edited)

The A* Pathfinding Algorithm finds the shortest path from point A to point B in any scenario. This is one of the most popular pathfinding algorithms.

This program gets the quickest path from cell A to cell B.

If you want to experiment with this code, download it and edit the background. Please know that it works best in enclosed spaces. If there is an opening, it would most likely have a memory error.

Have fun with it!

Update 1.1: I replaced some formulas with taxicab geometry ones in order to optimize the code. I also altered with the tracing a bit, so point B will now be converted into the point character.

Since both versions use different formulas, the results will be very different depending on your background. Ver. 1.0 will find the shortest path, while Ver. 1.1 will do the same, but the resulting path isn’t usually diagonal.

4-DirAStarTest.nx | Open in app
2020-08-22 01:16

nousername010 2020-08-22 02:27

You can learn more about the algorithm in this video: https://youtu.be/-L-WgKMFuhE


was8bit 2020-08-22 03:21

Perfectly made, as far as i could test it :)


GAMELEGEND 2020-08-22 04:33

does the B stand for bot


nousername010 2020-08-22 04:39

Thanks, that’s good to know. It’s my first time doing this algorithm, and I am very glad it turned out well.

B stands for the destination. It calculates a path from point A to point B. Since it makes the path by tracing the nodes from point B to point A, B does not get replaced by a path graphic.


Log in to reply.