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 explosionSprites = []
|
||||||
let health
|
let health
|
||||||
function nextLevel(time=0) {
|
function nextLevel(time=0) {
|
||||||
Tone.Transport.pause()
|
Tone.Transport.pause(time)
|
||||||
level++
|
level++
|
||||||
midiSong = Midi.fromUrl(`midi/${level}.mid`).then((midi) => {
|
midiSong = Midi.fromUrl(`midi/${level}.mid`).then((midi) => {
|
||||||
midiSong = 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 => 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()
|
levelDialog.showModal()
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user