As you can see I have two flying bodies - however only one gets cleared. If I set them to travel left, none get cleared. They are colliding against tiles so I am using blocked instead of touching, but what else am I missing?
this.bats.children.iterate((child) => {
child.body.setAllowGravity(false);
child.setActive(true);
child.setCollideWorldBounds(true);
let rightLoop,
leftLoop;
if(!child.flying){
console.log();
child.flying = true;
console.log('flying');
const firstLoop = setInterval(()=>{
console.log('loop');
child.setVelocityX(160)
if(child.body.blocked.right) {
console.log('clear');
clearInterval(firstLoop)
}
},60)
}