Problem with AStar Pathfinder

  ... in the unlikely case you discovered a bug, post it here.

Problem with AStar Pathfinder

Postby gforcer18 » Fri Mar 23, 2012 9:24 am

Hi

Got problem with TMX Parsing or AStar Pathfinder.

Task is to create path for mob using layer #0, but at the end, path always going through other layer, when it shouldnt

Snapshots of two seperated layers.

Here is image of how mob should go:
Image
But after astar pathfinding path looks like this:
Image

AStartPathfinder and TMX code looks like in example, no changes

Need help, cause can't even find reason of this :?:
gforcer18
 
Posts: 9
Joined: Wed Aug 10, 2011 6:31 am
Location: Russia, Izhevsk

Re: Problem with AStar Pathfinder

Postby Lokiare » Thu Apr 26, 2012 2:23 am

On a similar note. I can't get the Astar pathfinding to find a path using the example code. I'm using GLES1. When I look into the code there is a check to return 'null' if 'toNode.mParent == null' in findPath. I looked through the code but I can't find anywhere that 'toNode.mParent' is initialized. I'm using the latest version of GLES1 from Github.
Lokiare
 
Posts: 22
Joined: Tue Apr 03, 2012 8:47 am

Re: Problem with AStar Pathfinder

Postby Lokiare » Thu Apr 26, 2012 2:25 am

Are you checking all your TMXlayers? or all your TMXlayers that have objects you want to collide with? I'd go back and check your TMX map in the editor and see if the last part is different.
Lokiare
 
Posts: 22
Joined: Tue Apr 03, 2012 8:47 am

Re: Problem with AStar Pathfinder

Postby gforcer18 » Thu Apr 26, 2012 5:23 am

Problem solved :)

I had to just change the code in IsTileBlocked to:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. if (mTmxTile.getTextureRegion() != null)
  2.  return(false);
  3. else
  4.  return(true);
  5.  
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


that's all, simple
gforcer18
 
Posts: 9
Joined: Wed Aug 10, 2011 6:31 am
Location: Russia, Izhevsk

Re: Problem with AStar Pathfinder

Postby ViliamVolosV » Thu May 31, 2012 12:07 am

Hi. can you show how to use Astar algorithm in TMX map?
ViliamVolosV
 
Posts: 2
Joined: Thu Apr 19, 2012 12:57 pm


Return to Bugs

Who is online

Users browsing this forum: No registered users and 2 guests