Jump to content

game.load.onLoadComplete called too soon!


stevefromio
 Share

Recommended Posts

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

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...