Play sound during loader?

7 views
Skip to first unread message

Thomer Gil

unread,
May 14, 2020, 3:38:22 AM5/14/20
to excaliburjs
I'd like to play a sound while the loader loads. Can I pre-load one sound, then play() it, then load the rest? My first attempts failed.

Thank you.

Thomer Gil

unread,
May 14, 2020, 12:14:30 PM5/14/20
to excaliburjs
Kamran responded to me privately suggesting a good idea which I implemented. It doesn't exactly win the beauty prize (because you see two progress bars; one fast, one slow), but it works!

function startGame(urlParams: URLSearchParams): void {
    Game.Instance(urlParams)
        .start(preLoader)
        .then(() => {
            Game.Instance().playIntroSong();
            Game.Instance(urlParams).start(loader);
        });
}

preLoader loads only the song; loader loads the rest of the assets.

Kamran Ayub

unread,
May 14, 2020, 12:30:00 PM5/14/20
to Thomer Gil, excaliburjs
Hah! Oops, but glad that works. You can customize the draw of the loader(s) as well if you want to do that at some point. I believe we have some docs covering that:


--
You received this message because you are subscribed to the Google Groups "excaliburjs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to excaliburjs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/excaliburjs/cc6c366e-87f7-4369-8c9b-b2f418cc1553%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages