문제

Could anyone give me an example of source code which uses astar pathfinding algorithm with AndEngine on the TMXTiledMap. I am using AndEngine downloaded from https://github.com/nicolasgramlich/AndEngine.

Any suggestion would be appreciated. Thanks!

도움이 되었습니까?

해결책

This is the official TMXTiledMapExample, but it doesn't contain A* pathfinding. It can teach you about tiled maps, though.

Here is another example from the forums which does contain it. It isn't really an example, but the pathfinding code provided there works. I don't think there is any real example of A* pathfinding, never seen any tutorial of it (The best way to learn is to read the code yourself. Better take a look at AStarPathFinder.java code).

The important parts for you in the forum post are are (lines):

123: Initializing the AStarPathFinder

205 - 213: Converting screen/scene coordinates to map tiles and using the pathfinder.

224: The method loadPathFound - using the path returned by the pathfinder to move an entity.

The MyMap class in the third post.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top