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

186
Views
Problema de sonido en el bucle "for" cuando Player gana Javascript

Problema de sonido. En el bucle "for", se ha asignado un sonido cuando el automóvil golpea el hitbox del paquete a tomar ('pacz'). Esto se cuenta como un punto. Entonces el juego de sonido: 'bien'. Individualmente para cada paquete recogido. El problema surge cuando el jugador recolecta los 9 paquetes. El sonido "bueno" se enciende muchas veces al mismo tiempo. ¿Hay alguna manera de hacer que el sonido del paquete de 9 suene "bien" una vez al final del juego?

 var root = this var collectedBoxes = 0 root.mainPacz.gotoAndStop(boxArray[0]) carCollisionSetup() boxCollisionSetup() var gameover = false function boxCollisionCheck() { let carBounds = root.car.getTransformedBounds(); let infoBox = root.mainPacz for (i = 1; i < 10; i++) { let boxBounds = root['pacz' + i].getTransformedBounds() if (carBounds.intersects(boxBounds) && infoBox.timeline.position == root['pacz' + i].timeline.position) { takeAnim(root['pacz' + i]) collectedBoxes++ createjs.Sound.play('good') console.log('good w pacz') if (collectedBoxes < 9) { infoBox.gotoAndStop(boxArray[collectedBoxes]) } else { if(!gameover)winFunction() console.log(winFunction) console.log('wrong pacz else') } } } } function winFunction() { gameover = true console.log("=========WIN========") setTimeout (() =>{ createjs.Sound.play('swietnie') },1500) setTimeout (() =>{ root.play(); },5000) stopCycle() root.stoper.play() //clearInterval(carPosChange) //timerTimeMS = 0 } //ANCHOR Handling losing function loseFunction() { console.log("=========LOSE========") }

El final del juego con sonidos parece (estos "consol.log" se llaman muchas veces): ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza
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!