Set max angle to pathfinding behavior

From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Hello !

    I'm trying to use the behavior pathfinding but now it's out of my limit.

    I would like to set the max pathfinding angle to for example 10%.

    Should I modify theses part of the behavior below ? or should I do in another way?

    Thanks in advance for your help.

    // Check the box made by the start and dest cells.

              // If the complete box is empty, allow a direct move to target.

              var minX = Math.min(startX, endX);

              var maxX = Math.max(startX, endX);

              var minY = Math.min(startY, endY);

              var maxY = Math.max(startY, endY);


              // Path goes out of bounds: no calculable path

              if (minX < 0 || minY < 0 || maxX >= this.hcells || maxY >= this.vcells)






              var x, y, i, len, c, h, n;

              if (this.diagonalsEnabled)


                   var canMoveDirect = true;


                   for (x = minX; x <= maxX; x++)


                        for (y = minY; y <= maxY; y++)


                             if (this.cells[x][y] !== 0)


                                  canMoveDirect = false;


                                  // Break both loops

                                  x = maxX + 1;





  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)