Random position, check if is collider zone?

Hi,

This is my first post and I hope I can help and be helped in this forum. :blush:
i am develop my first game in phaser 3. its a RPG.

My question is: Its posible get random zone (X,Y) and check if is collider zone?
I am creating the enemies with random spawn position.

Thansk for all.

Hey @hardcarry

This example might work you maybe ?

https://labs.phaser.io/view.html?src=src/geom\rectangle\get%20random%20point.js

Try Arcade.Body#hitTest(x, y).

@hcakar This is not my case, i have objects inside in the rectangle with collisions

@samme iโ€™m trying your advice but this function returned me TRUE all time.

this.enemy = this.scene.physics.add.sprite(this.x, this.y, โ€˜enemyโ€™);
console.log(this.enemy.body.hitTest(this.x,this.y)); // true