diff --git a/public/src/js/keyboard.js b/public/src/js/keyboard.js index 959fbaf..a846934 100644 --- a/public/src/js/keyboard.js +++ b/public/src/js/keyboard.js @@ -12,17 +12,30 @@ function Keyboard(controller){ // Disable back navigation when pressing backspace e.preventDefault(); - if(!controller.autoPlay()){ + if(_this.buttonEnabled(e.which)){ _this.setKey(e.which, true); } }); $(document).keyup(function(e){ - if(!controller.autoPlay()){ + if(_this.buttonEnabled(e.which)){ _this.setKey(e.which, false); } }); + this.buttonEnabled = function(keyCode){ + if(controller.autoPlay()){ + switch(keyCode){ + case 86: + case 66: + case 67: + case 78: + return false + } + } + return true + } + this.checkGameKeys = function(){ if(_keys[86] && !_this.isWaitingForKeyup(86, "sound")){ @@ -58,7 +71,7 @@ function Keyboard(controller){ controller.songSelection(); } if(_keys[81] && !_this.isWaitingForKeyup(81, "menu")){ - // P, pause the game + // Q, pause the game _this.waitForKeyup(81, "menu"); controller.togglePauseMenu(); } diff --git a/public/src/js/soundsystem.js b/public/src/js/soundsystem.js index 295de8d..bf7e097 100644 --- a/public/src/js/soundsystem.js +++ b/public/src/js/soundsystem.js @@ -29,6 +29,10 @@ function soundSystem(controller){ } } + + this.pauseSound = function(){ + _sounds["main-music"].pause(); + } this.fadeOutMusic = function(){