I'am trying (without luck) to implement a function to mute/unmute all the sounds in my JavaScript file. Is a simple Pacman game, so the sounds could be a little anoying.
JavaScript:
this.pacmanRotation = this.Rotation.right;
this.wakaSound = new Audio("sounds/waka.wav");
this.powerDotSound = new Audio("sounds/power_Dot.wav");
this.powerDotSoundActive = false;
this.powerDotAboutToExpire = false;
this.timers = [];
this.eatGhostSound = new Audio("sounds/eat_ghost.wav");
this.madeFirstMove = false;
Html:
<button type="submit" class="neon">
<strong> <i class="fas fa-volume-down"></i> Sound</strong>
</button>
Html reference to canvas:
<div>
<canvas id="gameCanvas"></canvas>
</div>
I know how to do this with Audio/Video html tag, but here a could not make it work!
Any thoughts to how can i make this??