Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

220
Views
Cómo implementar música de fondo en tu juego de saltar y correr con niveles

Necesito hacer un proyecto para mi curso de TI en la escuela. Implementé un juego Jump N Run en Visual Studio Code con Javascript. Tiene 4 niveles y funciona con html. Mi maestro ahora dijo que tengo que agregar música de fondo. Y no tengo ni idea de por dónde empezar. Realmente no soy tan bueno en TI y, por lo tanto, realmente no sé qué información se necesita para ayudarme con esa pregunta. Podría enviar toda mi carpeta si fuera necesario. Gracias de antemano. PD: Necesito terminar para el final de la semana.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede hacer esto en JavaScript con bastante facilidad.

 // Create a variable to reference your music file // that is stored in a new Audio object const music = new Audio("./pathToMusicFile.wav"); // Add an event listener to detect user interaction // and add a callback function that will run when // the event occurs. I've added it to the window // here, but you could add the event to the button // that starts your game. I've named the callback // function playMusic here window.addEventListener("click", playMusic); // Function to play the music // in a continuous loop function playMusic() { // start the music music.play(); // make the music loop continuously music.loop = true; } // Note: If you want to stop the music at some point // you can do it like this: music.stop() // which you might want to do when each level of your // game ends, and then perhaps, play a different tune // for the next level

Esto debería ser suficiente para empezar, espero que ayude

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!