// category GameAudio var GameAudio = { active: false, // GameAudio.init(collection, containingFolder)

Starts the audio system, using an array of audio names 'collection' and a path 'containingFolder' in which the sounds can be found. Do not include file extentions in sound names! init: function(collection, containingFolder) { console.log("GAME: Loading sounds. (Note: Only supported from online-source, will fail when executed on local files.)"); try { var soundColl = []; for(var i = 0; i < collection.length; i++) { soundColl.push({name: collection[i], preload: true}); } if(containingFolder == null) containingFolder = ""; if(containingFolder != "") containingFolder += "/"; ion.sound ({ sounds: soundColl, volume: 1, preload: true, multiplay: true, path: containingFolder }); this.active = true; } catch(err) { console.log("GAME: ERROR: Sounds could not be loaded. Sound will not be available."); } }, // GameAudio.play(name)

plays a sound with the name 'name'. play: function(name) { if(this.active) ion.sound.play(name); } }