Creates an object for A* path finding Made using help from http://www.policyalmanac.org/games/aStarTutorial.htm.
More...
#include <aStar.h>
Creates an object for A* path finding Made using help from http://www.policyalmanac.org/games/aStarTutorial.htm.
AStar::AStar |
( |
int |
xNodes, |
|
|
int |
yNodes |
|
) |
| |
Constructs an AStar object
- Parameters
-
int | The number of nodes in a row |
int | The number of rows in the map |
Destructs an AStar object
void AStar::checkNodes |
( |
int |
parentX, |
|
|
int |
parentY |
|
) |
| |
|
private |
Check the surrounding nodes
- Parameters
-
int | The parent node x index value |
int | The parent node y index value |
void AStar::drawLists |
( |
SDL_Renderer * |
renderer | ) |
|
Displays the open and closed lists
- Parameters
-
SDL_Renderer* | A pointer to the renderer |
void AStar::findBestPath |
( |
| ) |
|
|
private |
void AStar::findNewPath |
( |
int |
startX, |
|
|
int |
startY, |
|
|
int |
endX, |
|
|
int |
endY |
|
) |
| |
Finds a new path to follow
- Parameters
-
int | The start x index value |
int | The start y index value |
int | The end x index value |
int | The end y index value |
void AStar::findNextNode |
( |
| ) |
|
|
private |
Vec2 AStar::getNextPathNode |
( |
| ) |
|
Returns the position of the next node in the path
- Returns
- Vec2 Node position
void AStar::nodeTest |
( |
int |
parentX, |
|
|
int |
parentY, |
|
|
int |
testX, |
|
|
int |
testY, |
|
|
int |
cost |
|
) |
| |
|
private |
Test the node for the open list setup
- Parameters
-
int | The parent x index value |
int | The parent y index value |
int | The test x index value |
int | The test y index value |
int | The cost to add to the node |
void AStar::setDangerNode |
( |
int |
nodeXIndex, |
|
|
int |
nodeYIndex |
|
) |
| |
std::vector<Node> AStar::bestPath |
|
private |
std::vector<Node> AStar::closedList |
|
private |
std::vector<std::vector<Node*> > AStar::nodes |
|
private |
std::vector<Node> AStar::openList |
|
private |
The documentation for this class was generated from the following files: