#define TILE_SIZE 20
#define MAP_WIDTH 800/TILE_SIZE
#define MAP_HEIGHT 600/TILE_SIZE
// Heuristic values
void Process (void); // find out which grid to go
void MoveToGrid (CEnemy Enemy_Obj); // go to grid
// open list is a list for nodes to be considered
// closed list is the list where the nodes are thrown into after being considered in open list
So I'm having problem in how to calculate which grid to go to. Cause once i have a list of Positions to go to, i dont think i should have a problem.
So I was just wondering if anyone know of any links that is useful in helping me to do pathfinding algorithm because the links I found were either too vague or too hard for me to understand. Or is anyone willing to give me the algorithm.
The first node to consider is the one you're standing on. When that doesn't work, close it and open all of its neighbors you haven't considered yet. Always consider the open node with least cost+heuristic. Note that you shouldn't use Vector2D for nodes - how will you know which way you came from, once you find the target?