Events scheduled inside of scheduled callbacks should use the passed in scheduling time

This commit is contained in:
Adrien MALINGREY 2024-09-23 19:29:55 +02:00
parent 257a354be7
commit 18b03a4975

4
app.js
View File

@ -439,7 +439,7 @@ let noteSprites = []
let explosionSprites = []
let health
function nextLevel(time=0) {
Tone.Transport.pause()
Tone.Transport.pause(time)
level++
midiSong = Midi.fromUrl(`midi/${level}.mid`).then((midi) => {
midiSong = midi
@ -460,7 +460,7 @@ function nextLevel(time=0) {
Tone.Transport.scheduleOnce(time => noteSprites.push(noteSprite), time + note.time)
})
})
Tone.Transport.scheduleOnce(time => nextLevel(time), time + midiSong.duration + TIME_TO_SCREEN)
Tone.Transport.scheduleOnce(nextLevel, time + midiSong.duration + TIME_TO_SCREEN)
levelDialog.showModal()
}).catch((error) => {