Cocos2d iOS A* Star Path finding help
Posted
by
user32581
on Game Development
See other posts from Game Development
or by user32581
Published on 2013-06-29T02:31:47Z
Indexed on
2013/06/29
4:29 UTC
Read the original article
Hit count: 204
cocos2d-iphone
Hello I need help implementing this class https://github.com/sqlboy/tiled-games/tree/master/src into my iOS game.
Im using the suggested code of:
AStarPathFinder pathFinder = [[AStarPathFinder alloc]
initWithTileMap:tileMap collideLayer:@"collide"];
// Optionally, you can set the name of the collide property key and the value it expects.
[pathFinder setCollideKey:@"collidable"] // defaults to COLLIDE
[pathFinder setCollideValue:@"True"] // defaults to 1
// highlight a path (src and dst are tile coorindates)
[pathFinder highlightPathFrom:srcTile to:dstTile];
// move a sprite
[pathFinder moveSprite:player from:srcTile to:dstTile atSpeed:0.1f];
I get the following error: Instance method '-initWithTileMap:collideLayer:' not found (return defaults to 'id')
This is the official post for the class: http://www.cocos2d-iphone.org/forums/topic/just-pushed-a-cctmxtiledmap-a-pathfinding-class-to-github/
The only other code I added was: #import "AStarPathFinder.h" I think I am perhaps missing something!
I am grateful for any help!
© Game Development or respective owner