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;
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;