Mwyann / ydkjs

You Don't Know Javascript
https://www.ydkjs.eu/
GNU General Public License v3.0
60 stars 9 forks source link

JackAttack bug: question skip too early #5

Closed Mwyann closed 4 years ago

Mwyann commented 4 years ago

From mail: there's a glitch with the JackAttack where a new question would start before the previous one is done, which breaks the game.

ydkjukbug

From first look, the issue seems to be related to ModeJackAttack.js, var BGMusicEnded which would be fired twice. I'm using the number of loops of the music to know when to skip to the next question. In theory there is two loops for each questions, but for some reason, as can be seen on your video, the next question is triggered after only one pass of the background music. And since the previous question isn't done yet, it wrecks everything. I'll have to look why the end of the music is triggered more than once, and if needed find another way of triggering the next question.

Thanks to @jdomingo1102 for reporting this bug and doing all those tests!

Mwyann commented 4 years ago

Fixed by this commit: https://github.com/Mwyann/ydkjs/commit/8023d4647229412b3320aee82cb62a04d47dae64

The bug was that when an audio file is looping, the "ended" event was fired twice the first time by mistake. It was introduced by this commit: https://github.com/Mwyann/ydkjs/commit/2560ff2fd36e118c502e7d13dc3c2f725b1674ac