Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

78
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda