Here is the code
let enemys = this.physics.add.group();
for(let i=0; i<5; i++){
let x = Math.round(Math.random()*(1000)+100);
let y = Math.round(Math.random()*(600)+100);
let o = this.physics.add.image(x,y,'b');
o.setDamping(true);
o.setDrag(0.99);
o.setMaxVelocity(80);
o.timer = 3;
o.setCollideWorldBounds();
random_move(o);
enemys.add(o);
}
I can’t move /accelerate object (random_move) on created and i can’t setCollideWorldBounds(), unless i waited a second to do it.
Btw it’s working fine when i create un-grouped object.
How to fix this?
Thanks