Skip to content

mihailt/Astar-Pathfinding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Astar-Pathfinding

Usage:

int cols = 8;
int rows = 8;
AStar * pathFinder = [[AStar alloc] initWithGrid:[[AStarGrid alloc] initWithCols:cols andRows:rows]];
AStarNode * start = [pathFinder.grid getNodeAtPosition:ccp(0,0)];
AStarNode * end = [pathFinder.grid getNodeAtPosition:ccp(7,7)];
[pathFinder.grid setStartNode:start];
[pathFinder.grid setStartNode:end];
if ([pathFinder findPath]) {
	// pathFinder.path now contains NSMutableArray with AStarNode objects you need to visit to get to end node
	// it's up to you  to move required object along the path
} else {
	// no path to end node
}

Additional info

some configuration settings are in AStarConstants.h and default heruistic type is set to Eclidian in Astar.m initWithGrid method

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published