vmars316 Posted February 3, 2016 Share Posted February 3, 2016 game.add.audio vs game.sound.add I notice that the tutorial :http://thoughts.amphibian.com/2015/11/hit-ground-play-sound.html uses game.sound.add where as the phaser/examples use game.add.audio . Any pros/cons ? Thanks Link to comment Share on other sites More sharing options...
rcoaxil Posted February 4, 2016 Share Posted February 4, 2016 Field "game.add" refers to GameObjectFactory, and its function "audio" looks as following: Phaser.GameObjectFactory.prototype = { //***// audio: function (key, volume, loop, connect) { return this.game.sound.add(key, volume, loop, connect); }, //***// } So there's precisely zero difference since both do exactly the same thing. From really pedantic standpoint, "game.sound.add" is marginally faster performing since you don't have to reference the GameObjectFactory first nor call its wrapper function - not that it's relevant, with the kind of frequency you'd call this function. You can use whichever you find better fitting with the rest of your code. vmars316 1 Link to comment Share on other sites More sharing options...
Recommended Posts