app/scripts/core/gameCoordinator.js
/**
   * Handle behavior for the pause key
   */
Handle behavior for the pause key
Handle behavior for the pause key
handlePauseKey() {
    if (this.allowPause) {
      this.allowPause = false;
      setTimeout(() => {
        if (!this.cutscene) {
          this.allowPause = true;
        }
      }, 500);
      this.gameEngine.changePausedState(this.gameEngine.running);
      this.soundManager.play(pauseSound);
      if (this.gameEngine.started) {
        this.soundManager.resumeAmbience();
        this.gameUi.style.filter = 'unset';
        this.movementButtons.style.filter = 'unset';
        this.pausedText.style.visibility = 'hidden';
        this.pauseButton.innerHTML = 'pause';
        this.activeTimers.forEach((timer) => {
          timer.resume();
        });
      } else {
        this.soundManager.stopAmbience();
        this.soundManager.setAmbience(pauseBeatSound, true);
        this.gameUi.style.filter = 'blur(5px)';
        this.movementButtons.style.filter = 'blur(5px)';
        this.pausedText.style.visibility = 'visible';
        this.pauseButton.innerHTML = 'play_arrow';
        this.activeTimers.forEach((timer) => {
          timer.pause();
        });
      }
    }
  }
handlePauseKey ( ) { if ( this . allowPause ) { this . allowPause = false ; setTimeout ( ( ) => { if ( ! this . cutscene ) { this . allowPause = true ; } } , 500 ) ; this . gameEngine . changePausedState ( this . gameEngine . running ) ; this . soundManager . play ( pauseSound ) ; if ( this . gameEngine . started ) { this . soundManager . resumeAmbience ( ) ; this . gameUi . style . filter = 'unset' ; this . movementButtons . style . filter = 'unset' ; this . pausedText . style . visibility = 'hidden' ; this . pauseButton . innerHTML = 'pause' ; this . activeTimers . forEach ( ( timer ) => { timer . resume ( ) ; } ) ; } else { this . soundManager . stopAmbience ( ) ; this . soundManager . setAmbience ( pauseBeatSound , true ) ; this . gameUi . style . filter = 'blur(5px)' ; this . movementButtons . style . filter = 'blur(5px)' ; this . pausedText . style . visibility = 'visible' ; this . pauseButton . innerHTML = 'play_arrow' ; this . activeTimers . forEach ( ( timer ) => { timer . pause ( ) ; } ) ; } } }
Handle behavior for the pause key
Handle behavior for the pause key