Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(3 edits)

A star in a tile map? That's unusual... Is it a square tile? Hexa-tile?

If the tile map is empty then the optimal path is always a straight line, if not then you should build your graph out of the walkable tiles.

So, accessing the neighbors works by converting or at least treating the tiles like nodes. For instance, if we're talking square tiles, and your tile in question has a "wall" just below it, then this tile has a list of 3 neighbors, one on each side and one right above it. You will have to do that iteratively, generating a list  of neighbors for each tile/node (it may be inefficient but good enough for a school work), for all your tiles in the map before you run the A star, got it?