stevefromio Posted July 27, 2015 Share Posted July 27, 2015 function preload() { game.load.image('sky', 'assets/sky.png');game.load.image('ground', 'assets/platform.png');game.load.image('star', 'assets/star.png');game.load.spritesheet('dude','assets/dude.png', 32, 48);game.load.spritesheet('enemy','assets/baddie.png', 32, 32);game.load.audio('music', 'assets/soundtrack.mp3');game.load.audio('enemy-move','assets/cyborg-move.wav');game.load.audio('enemy-jump','assets/cyborg-jump.wav');game.load.onLoadComplete.add( function() {console.log('completed loading all assets.');});} Even though console.log prints, the sound effects and music haven't finished loading yet. Is there something wrong with my code? Thanks, Steve Link to comment Share on other sites More sharing options...
rich Posted July 27, 2015 Share Posted July 27, 2015 They've finished loading, but they still need to decode. Unless it's on iOS, when they won't even load until a touch event occurs. Link to comment Share on other sites More sharing options...
stevefromio Posted July 27, 2015 Author Share Posted July 27, 2015 This is not on iOS ... OK, so I add an onDecoded signal .... but I never see the console.log('sound is ready?');. Also, why does a wav file need to be decoded? var m = game.add.audio('music', 0.05);game.add.audio('enemy-move',0.5);game.add.audio('enemy-jump',0.5); //m.play();j = game.sound.play('enemy-jump');j.onDecoded.add(function () {console.log('sound is ready');},this); if (j.isDecoded === false)console.log('wav file is coded?');} Link to comment Share on other sites More sharing options...
stevefromio Posted July 28, 2015 Author Share Posted July 28, 2015 I was using an old version of Phaser. Link to comment Share on other sites More sharing options...
Recommended Posts