How do I use pathfinding?

0 favourites
  • 3 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Hey guys,

    I'm kinda new to C2 and would like sumone to explain to me how to use the pathfinding behaviour. Can i make the enemy to find his way to the player? How?



  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The easiest way is to start a new project and select the Turret Defense template. It has a pre-built pathfinding example you can play with.

  • Supposing that you already know how to add behaviours to objects, the basic idea is this:


    • make your object find an endpoint (there is always a start point and an endpoint even if you do fancy thinks like teletransportation o even a pathfinding loop, the start point is the actual x,y point where your pathfinder object is standing in the moment it starts moving towards the chosen path, the endpoint is the position you want your pathfinder to reach), it could be the position of another object or whatever you want depending on what you want to achieve. This can be achieved with the "find path" action.
    • Use the on path found event in order to "tell" your object to start doing something the moment it finds the path toward the desired endpoint.
    • In the on path found event use the action "Move along path" to tell the object to follow the path already found (pretty obvious maybe but just in case ) .
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)