Hey everyone, im trying to learn the A* pathfinding algoritm, which is simple enough when using winforms or console applications, but for various reasons im having dificulty making it work with monogame, im too stubborn to quit however Do any of you know any monogame examples of pathfinding algoritms? (That does not use a custom made library. which all the examples i could find did). I would help alot to see how everyone else implements this stuff in monogame
I have done A* for a game I never finished with vanilla monogame…
It was going to be a complete heroes 3 clone, using all the original sprites and my own expansions… But I only ever finished the terrain editor and hero movement…
So you click somewhere on the scrolling map grid, and it plots a course from the current heroes tile, around obstacles like impassable terrain, to the clicked tile.
Each tile on this course, has its grid-address, or instance, added to a list, and for each (item on that list), a green X is drawn on the map screen, so you can preview the route…
Click again, and the hero sprite moves along the path, one list-item at a time, or until the player interrupts…
So:
To start with, you need a grid to move across, like a tile grid of some kind, where each tile is an instance of a class that contains a variable to store that individual tiles pass-ability. Like tiles with walls would be marked as impassable…
If you can set that up, then I think I can take you through the rest based on my old code… If you want.