Sign in to follow this  
damager

Sound muteOnPause problem

Recommended Posts

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

Share this post


Link to post
Share on other sites

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? 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.