enriqueto Posted September 19, 2014 Share Posted September 19, 2014 For the game I'm currently doing we need to use around 30 effects. That's a big number of files to download. Do you recommend audio sprites? If yes which tool should we use to generate them? Link to comment Share on other sites More sharing options...
d13 Posted September 20, 2014 Share Posted September 20, 2014 This recent video on audio sprites might already be out of date, but it's still worth watching: Link to comment Share on other sites More sharing options...
eguneys Posted September 20, 2014 Share Posted September 20, 2014 I use this tool: https://github.com/tonistiigi/audiosprite. Link to comment Share on other sites More sharing options...
CtlAltDel Posted September 20, 2014 Share Posted September 20, 2014 I use the tool eguneys mentions as well and then some simple code to add the markers. The sfxjson is the file generated by the tool. this.sfx = this.game.add.audio('sfx');this.sfxjson = this.game.cache.getJSON('sfxjson');var asm = this.sfxjson["spritemap"];for (var key in asm) { if (asm.hasOwnProperty(key)) { this.sfx.addMarker(key, asm[key]["start"], asm[key]["end"] - asm[key]["start"]); }}After that just do:this.sfx.play('somemarker'); Link to comment Share on other sites More sharing options...
eguneys Posted September 20, 2014 Share Posted September 20, 2014 @CtrlAltDel, Yes I use a very similar code, but I have to call this in every state, do you call it in every state too, and track this.sfx everywhere you go? Link to comment Share on other sites More sharing options...
CtlAltDel Posted September 20, 2014 Share Posted September 20, 2014 I only call it in my main state, but that's because I currently only have one state that uses sound. Link to comment Share on other sites More sharing options...
enriqueto Posted September 22, 2014 Author Share Posted September 22, 2014 thanks for the advice! Link to comment Share on other sites More sharing options...
Recommended Posts