Hi guys, Right now I’m focused on making a game, but I’m having a little trouble.So, I want to make this button work, when I double click it, the in-game sound will disappear.Does anyone know a solution to solve it
this is the code that i previously made:
this.On = this.add.image(290, 500, ‘Son’);
this.On.setDepth(100);
this.On.setScale(0);
this.On.setVisible(true);
this.On.setInteractive();
this.tweens.add({
targets: this.On,
ease: ‘Quad’,
duration: 500,
scaleX: 1,
scaleY: 1
});
//event listener untuk button sound_on
this.input.on(‘gameobjectover’, function (soundon, soundison){
console.log(“Object Over”);
if (!this.clicking) return;
if (!this.soundIson && soundison == this.On){
this.On.setTint(0x616161);
}
}, this);
this.input.on(‘gameobjectout’, function (soundon, soundison){
console.log(“Object Out”);
if (!this.clicking) return;
if (!this.soundIson && soundison == this.On){
this.On.setTint(0x2FCA9F);
this.Mambience.play();
this.Smati.play();
this.Sklik.play();
this.Stekan.play();
this.Stransisi.play();
}
}, this);
this.input.on(‘gameobjectdown’, function (soundon, soundison){
console.log(“Object Click”);
if (!this.soundIson && soundison == this.On){
this.On.setTint(0x616161);
this.clicking = true;
}
}, this);
this.input.on(‘gameobjectup’, function (soundon, soundison){
console.log(“Object End Click”);
if (!this.soundIson && soundison == this.On){
this.On.setTint(0xffffff);
this.Soundon();
}
}, this);
this.input.on(‘pointerup’, function (soundon, currentlyOn){
console.log("suaranya gak ada");
this.clicking = true;
if (!this.soundIson) return;
}, this);
this.input.on(‘gameobjectup’, function (soundoff, soundisoff){
console.log(“Object End Click”);
if (!this.soundIsoff && soundisoff == this.Off){
this.Off.setTint(0xffffff);
this.Soundoff();
}
}, this);
this.input.on(‘pointerup’, function (soundoff, currentlyOff){
console.log("suaranya mana ajg");
this.clicking = true;
if (!this.soundIsoff) return;
}, this);