Events scheduled inside of scheduled callbacks should use the passed in scheduling time
This commit is contained in:
parent
257a354be7
commit
18b03a4975
4
app.js
4
app.js
@ -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) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user