Pausing the game will now mute audio and resuming will un-mute, unless it was muted via the game (fixes #439)

This commit is contained in:
photonstorm
2014-02-25 03:12:12 +00:00
parent 415342d986
commit cc06a62b90
4 changed files with 80 additions and 34 deletions
+14 -1
View File
@@ -31,12 +31,25 @@ function create() {
game.onResume.add(resumed, this);
var space = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR);
space.onDown.add(pauseToggle, this);
space.onDown.add(muteToggle, this);
s.push('starting: ' + game.stage._hiddenVar);
}
function muteToggle() {
if (game.sound.mute)
{
game.sound.mute = false;
}
else
{
game.sound.mute = true;
}
}
function pauseToggle() {
if (game.paused)