Jump to content

When the sound object gets created?


spinnerbox
 Share

Recommended Posts

I create new game object with

var game = new Phaser.Game(STAGE_WIDTH, STAGE_HEIGHT, phaser.AUTO, HTML_CONTAINER);

and right after this line I call to set game.sound.mute = true/false depending on the saved value in window.localStorage.

But the problem is, when I console.dir(game), it prints the structure of the Phaser game object but game.sound is still null, so I cannot set the sound to muted or unmuted at that moment.

When does game.sound sub-object gets created?

Link to comment
Share on other sites

Something sounds weird here, because if you tried to set the 'mute' property on 'game.sound' when 'game.sound' is null, you'd see an error in the JavaScript console complaining about trying to do something with a null value.

You should make sure that code is actually executing, and then if it's not, find the right place to put it. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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