Jump to content

How do you keep music playing between states?


zencha
 Share

Recommended Posts

Hey guys, I begin playing some music on my Menu state and then I have a "store" state where the player can shop. I want the music to continue playing if the player switches between the main menu and the store state. 

 

Strange thing is, this was working previously. I probably broke it, but I can't figure out how because there's no code on the the store state about music.

 

 

Link to comment
Share on other sites

  • 1 year later...

Hi, I have the same issue, did you fix it?

I add music to game and play it on create function in other states. But it didn't take effect.

            this.game.music = this.game.add.audio('theme', 1, true);
and

            if(!this.game.music)
                this.game.music = this.game.add.audio('theme', 1, true);
            if(this.game.music.isPlaying == false)
                this.game.music.play();

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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