Is there a way no not let objects spawn above each other?
//criar 50 zonas de objetos
this.objects = this.physics.add.group({
classType: Phaser.GameObjects.Sprite
});
for(var i = 0; i<600; i++){
var x = Phaser.Math.RND.between(50, this.physics.world.bounds.width - 100);
var y = Phaser.Math.RND.between(50, this.physics.world.bounds.height - 100);
//if para evitar criar objetos na areia e nos obstaculos
if(!this.obstaculos.getTileAtWorldXY(x, y) && !this.areia.getTileAtWorldXY(x, y)){
this.objects.create(x, y, this.getObjectSprite());
}else{
// console.log('Colision with layers');
i--;
}
}