mirror of
https://github.com/wassname/phaser.git
synced 2026-08-14 12:40:17 +08:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user