У меня есть некоторые проблемы с событием перекрытия в Phaser 3 Вот мой код:
this.counter = 0;
this.physics.add.overlap(this.player, this.coinGroup, function(player, coin){
this.tweens.add({
targets: coin,
y: coin.y - 100,
alpha: 0,
duration: 800,
ease: "Cubic.easeOut",
callbackScope: this,
onComplete: function(){
this.coinGroup.killAndHide(coin);
this.coinGroup.remove(coin);
}
});
this.counter++
}, null, this);
console.log(this.counter);
Когда игрок перекрывает монету, счетчик должен быть равен «1». Но это «2» в консоли. Как это работает? Где я должен сделать изменения? Спасибо.