0 favourites
  • <img src="http://dl.dropbox.com/u/36472942/construct/plugin/release/pathfinder/demo/images/source-default-000.png" border="0"><img src="http://dl.dropbox.com/u/36472942/construct/plugin/release/pathfinder/demo/images/obstacle-default-000.png" border="0">

    <img src="http://dl.dropbox.com/u/36472942/construct/plugin/release/pathfinder/demo/images/arrow-default-000.png" border="0"> <img src="http://dl.dropbox.com/u/36472942/construct/plugin/release/pathfinder/demo/images/arrow-default-000.png" border="0"> <img src="http://dl.dropbox.com/u/36472942/construct/plugin/release/pathfinder/demo/images/arrow-default-000.png" border="0"> <img src="http://dl.dropbox.com/u/36472942/construct/plugin/release/pathfinder/demo/images/dest-default-000.png" border="0">

    <center><font size="6"><font color="red">- THIS BEHAVIOR IS NOT SUPPORTED ANYMORE, PREFER USING THE OFFICIAL ONE -</font></font>

    The official pathfinding manual entry</center>

    The rest of this posts stays for legacy purpose, but if you are a beginner/newcomer/first time pathfinder user just go away now and stick with the official behavior/documentation. Pathfinding examples are provided with your Construct2 installation in the folder "examples".


    A pathfinder allows you to find the shortest path between a source and a destination, while avoiding obstacles on a map.

    Check this demonstration which also acts as the pathfinder's documentation.

    You can download the example .capx (it is fully commented)

    You first need to have a copy of the behavior in your C2 folder before being able to load the .capx

    And for your pleasure the Pathfinder behavior itself.

    Unzip the content of pathfinder.zip in:


    (it should create a 'pathfinder' folder and the files should sit nicely in there)

    You can also find a new example showing you how to move an object with the pathfinder behavior.

    This example is available here

    Here also come an example allowing you to display "in real time" the possible path the unit might take. Get it here now.

    Have fun finding paths. <img src="smileys/smiley2.gif" border="0" align="middle">

    Important note about the usage of the PathFinder

    Now the PF boards is accurate with the setting of the obstacles, no matter what their size is, as long as you respect the square grid aspect in your level design.

    <img src="http://dl.dropbox.com/u/36472942/construct/plugin/release/pathfinder/r75-inprogress.PNG" border="0">

    Quick image to show, the blue "mask" represents what the PF knows as "unwalkable" squares. The red sprite is the player.

    You can see the first wall on the top left has a "double" mask compared to the other obstacles.

    It's because of its position.

    The CSS (Cell's Side Size) there is 32. And the wall's position happen also to be 32, meaning it sits on the edge of 2 squares.

    And so it will appear as your sprite is avoiding the wall when it seems it should walk right next to it.

    So if you respect the positioning of the obstacles in your level designs, it will work as intended (the rest of the blue masks).

    Change/edits log:

    11-09-2011: Reuploaded PFDemo.capx and the C2runtime.js from the demo to fix a bug in the drag/drop method (When dragging Source on Destination, Destination also get picked as to be dragged/dropped. And vice versa.)

    13-09-2011: Reuploaded PFDemo.capx and the C2runtime.js from the demo to fix a bug when clicking the GUI panel button, if the panel was showing/hiding and/or the commands fading in/out.

    Update to the PathFinder behavior runtime itself (setCellSizeSide). It appeared that the PathFinder was looking for a path out of the layout boundaries.

    09-01-2012: Update to the PathFinder Behavior: corrected bugs concerning the cleaning of the ObstList and the bounding boxes of obstacles. If you had prior troubles with having several obstacles, this should now be fixed, and you should be able to place/use obstacles far more easier.

    Fixes thanks to

    Moving the object with pathfinder behavior thanks to Yann & myself.

    16-01-2012: Update to the PF behavior. Fixing of all previous bugs, fixing of the obstacle recognition (wasn't good enough yet). Fixing of the moving example and addition of the moving with preview example.

    edited><editid>Kyatric</editid><editdate>2013-07-06 00:40:41</editdate></edited>

  • I think it could be very useful.

    Thank you ! <img src="smileys/smiley1.gif" border="0" align="middle" />

  • i love you...in the manliest of ways...lol.

  • Thanks!

  • Always wished we had a behavior like this for CC.

    Good job! Glad you got it working.

  • Thanks for the comments.

    let me know if you find bugs or have a hard time using the behavior despite the example/documentation.

    <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Good job and very useful!

  • That is is very, very good. I commend you, sir <img src="smileys/smiley10.gif" border="0" align="middle" />

  • That's great, I've wanted to make it in CC, but never really finished, thank you.

  • I got error while loading and just when I posted the problem I found out I put the behavior into the plugin's folder <img src="smileys/smiley18.gif" border="0" align="middle" />

  • Ha yes, to open the .capx, you first need the behavior in C2 folders.

    Added the info on the first post.

    Thanks for the comments and feedback.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Amazing <img src="smileys/smiley32.gif" border="0" align="middle" /> this will be massively useful! Thanks Kyatric.

  • This is great, much appreciated.

  • Thanks kyatric! That's a very useful behavior, well done!

  • Job well done!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)