Phaser 3.24.1, Arcade physics
Hello there,
I’ve added overlap checking for object player, but i have questions:
this.enemies = this.physics.add.group({
key: 'enemy',
repeat: 11,
setXY: { x: 12, y: 0, stepX: 70 }
});
this.physics.add.overlap(this.player, this.enemies, () => {
console.log('overlap');
}, null, this);
setInterval(() => {
this.enemies = this.physics.add.group({
key: 'enemy',
repeat: 11,
setXY: { x: 12, y: 0, stepX: 70 }
});
this.physics.add.overlap(this.player, this.enemies, () => {
console.log('overlap');
}, null, this);
}, 5000);
This code works only with first wave of enemies.
Overlap not working for second wave, so I add overlap each new wave of enemies.
How to fix this?
How to add trigger to check overlap for each object?
For example - player can shoot. I think - it is not good solution to add overlap listener to each bullet =)