damager Posted January 29, 2018 Share Posted January 29, 2018 Hi, i have music in my game, but i don't want to stop it when game paused. I found "this.game.muteOnPause = false" but it doesn't work. What am i doing wrong? Thanks. Phaser v2.10.0 Link to comment Share on other sites More sharing options...
QLNEO Posted January 29, 2018 Share Posted January 29, 2018 Wow, I just posted a similar thread before seeing this one existed. I almost feel bad. By any chance, does it mute when the game window is unfocused or only when it's triggered ingame? Link to comment Share on other sites More sharing options...
damager Posted January 29, 2018 Author Share Posted January 29, 2018 It doesn't mute when the game window is unfocused, but when game paused it does. Link to comment Share on other sites More sharing options...
damager Posted January 29, 2018 Author Share Posted January 29, 2018 Okay, i don't know who is fixing bugs on phaser. But that was definately bug. I add code of checking boolean "muteOnPause", cause that checking was only in Stage Visability handler, not in game pause setter. I think that there's can be another variable like "muteOnDomPause" and "muteOnPause". set: function (value) { if (value === true) { if (this._paused === false) { this._paused = true; if (this.sound.muteOnPause) { this.sound.setMute(); } this.time.gamePaused(); this.onPause.dispatch(this); } this._codePaused = true; } else { if (this._paused) { this._paused = false; if (this.sound.muteOnPause) { this.sound.unsetMute(); } this.input.reset(); this.time.gameResumed(); this.onResume.dispatch(this); } this._codePaused = false; } } P.S In my game i did the next thing: i create 2 variables: muteOnDOMPause and muteOnPause. and every usage of previous of muteOnPause i change as muteOnDOMPause, and in setter of game pause and only there i use muteOnPause; In game i can actually choose what kind of mute i need Link to comment Share on other sites More sharing options...
samme Posted January 29, 2018 Share Posted January 29, 2018 It's always worked this way. I guess it should be called muteOnBlur. If you're setting game.pause yourself you can just set game.sound.mute as well. Or use the onPause/onResume signals. Link to comment Share on other sites More sharing options...
Recommended Posts