Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

73
Vistas
Mute button for a CanvasGame in Javascript

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> &nbsp; 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??

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda