iamskey's Forum Posts

  • 1 posts
  • I think the pathfinding plugin need 1 more function: "Regenerate Path Of Map Obstacles", cause the default "Regenerate obstacle map" on huge maps make lags....

    I wrote this(and of course it works):

    	
    Acts.prototype.RegeneratePathOfMap = function (_position_x,_position_y,_radius)
    	{
    		var myinfo = this.getMyInfo();
    		
    		var arr = myinfo.cells;
    		var x, y;
    		_position_x = Math.floor(_position_x / this.cellSize);
    		_position_y = Math.floor(_position_y / this.cellSize);
    		var x1 = _position_x-_radius, x2 = _position_x+_radius;
    		var y1 = _position_y-_radius, y2 = _position_y+_radius;
    		for (x = x1; x <= x2; x++)
    		{			
    			for (y = y1; y <= y2; y++)
    				arr[x][y] = this.queryCellCollision(x, y);
    		}
    		
    		myinfo.cells = arr;
    		myinfo.pathfinder["init"](this.myHcells, this.myVcells, arr, this.diagonalsEnabled);
    		
    	};
    [/code:zuwugkw0]
    ...
    [code:zuwugkw0]
    AddNumberParam("PostionX", "Postion X");
    AddNumberParam("PostionY", "Postion Y");
    AddNumberParam("Radius", "Radius in cells");
    AddAction(15, af_none, "Regenerate Path Of Map Obstacles", "", "New obstacles near [<i>{0}</i>, <i>{1}</i>] with radius <i>{2}</i> cells", "Regenerate Path Of Map Obstacles near point", "RegeneratePathOfMap");
    [/code:zuwugkw0]
    i just put it here...
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 1 posts