hi all, could anyone help me,
I want to add score after collision, but it doesn’t work… the score not add +1, but add > +1
this.input.on('pointerdown', function (pointer) {
this.tweens.add({
targets: this.dubai,
y: { value: 3000, duration: 1500}
});
//collision
this.physics.add.existing(this.dubai)
this.physics.add.existing(this.dubaiitem)
this.physics.add.existing(this.dubaiitem2)
this.dubaicol = this.physics.add.collider(this.dubaiitem, this.dubai, this.onCollideHandler, null, this)
this.dubaicol2 = this.physics.add.collider(this.dubaiitem2, this.dubai, this.onCollideHandler, null, this)
}, this);
}
onCollideHandler () {
this.score += 1;
this.scoreText.setText(this.score)
console.log('oke')
}