coroutine
Callable
Parameters
coroutineGenerator: CoroutineGenerator
coroutine generator function
optionaloptions: CoroutineOptions
optionally schedule coroutine pre/post update
Returns CoroutineInstance
coroutine generator function
optionally schedule coroutine pre/post update
Excalibur coroutine helper, returns a [[CoroutineInstance]] which is promise-like when complete. Coroutines run before frame update by default.
Each coroutine yield is 1 excalibur frame. Coroutines get passed the elapsed time out of yield. Coroutines run internally on the excalibur clock.
If you yield a promise it will be awaited before resumed (the
yieldexpression still evaluates to the resumed frame's elapsed ms, not the promise's resolved value) If you yield a number it will wait at least that many ms before resumed (theyieldexpression evaluates to the resumed frame's elapsed ms)