Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

How check if new created object is overlaping collision layer


surzo18
 Share

Recommended Posts

(Phaser3)

Hi i have problem with checking if new created object is overlaping with walls. I really don't know how to do this with Phaser.

Don't know why i can't upload image so here is link with image: https://ctrlv.cz/61yh

My Code looks like this for now:

function updateAi(){

    if ( enemies.children.size === 0)
    {
        for(var i=0 ; i <= Lvl; i++){
            var ranX = Phaser.Math.Between(17,map.widthInPixels - 16 );
            var ranY = Phaser.Math.Between(17, map.heightInPixels - 16);
            var newOrk = enemies.create(ranX, ranY, 'orc');
            i++;
            
            //IF NEW ORK OVERLAPING OTHER ORK OR WALLS CREATE NEW ORK
        }
    }
}

Thx for help. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...