loranger Posted January 24, 2015 Share Posted January 24, 2015 Hello, I try to make a music quiz game using Panda.js.The lack of tutorials/samples is quite hard, but the api is so awesome I still want to dig in deeper. I need to load a bunch of small audio files each time I enter on a scene. I need them not to be loaded as assets in the game bootstrap, but dynamically. I'd like to, for instance, load a json file which contain an array of the files url to be loaded each time a scene.init is called ?Is there a way to achieve it using Panda.js ? Quote Link to comment Share on other sites More sharing options...
Stephan Posted January 24, 2015 Share Posted January 24, 2015 Yes you can do that. Here is a code sample that I use for similar purposes:var wordsToDo = [{word:"rat", file: "L"}, {word:"bat", file: "L"}];//load soundfilesfor(var i=0; i<this.wordsToDo.length; i++){ game.addAudio('sound/' + wordsToDo.word + '.*', wordsToDo.word);}var loader = new game.Loader();loader.onComplete(this.yourFunction.bind(this));loader.start(); Quote Link to comment Share on other sites More sharing options...
loranger Posted January 25, 2015 Author Share Posted January 25, 2015 Exactly what I needed, thank you so much Stephan ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.