app/scripts/core/gameCoordinator.js
/**
   * Upon eating a ghost, award points and temporarily pause movement
   * @param {CustomEvent} e - Contains a target ghost object
   */
Upon eating a ghost, award points and temporarily pause movement
@param {CustomEvent} e - Contains a target ghost object
Upon eating a ghost award points and temporarily pause movement @param { CustomEvent } e - Contains a target ghost object
eatGhost(e) {
    const pauseDuration = 1000;
    const { position, measurement } = e.detail.ghost;
    this.pauseTimer({ detail: { timer: this.ghostFlashTimer } });
    this.pauseTimer({ detail: { timer: this.ghostCycleTimer } });
    this.pauseTimer({ detail: { timer: this.fruitTimer } });
    this.soundManager.play(eatGhost);
    this.scaredGhosts = this.scaredGhosts.filter(
      ghost => ghost.name !== e.detail.ghost.name,
    );
    this.eyeGhosts += 1;
    this.ghostCombo += 1;
    const comboPoints = this.determineComboPoints();
    window.dispatchEvent(
      new CustomEvent('awardPoints', {
        detail: {
          points: comboPoints,
        },
      }),
    );
    this.displayText(position, comboPoints, pauseDuration, measurement);
    this.allowPacmanMovement = false;
    this.pacman.display = false;
    this.pacman.moving = false;
    e.detail.ghost.display = false;
    e.detail.ghost.moving = false;
    this.ghosts.forEach((ghost) => {
      const ghostRef = ghost;
      ghostRef.animate = false;
      ghostRef.pause(true);
      ghostRef.allowCollision = false;
    });
    new Timer(() => {
      this.soundManager.setAmbience(eyesSound);
      this.resumeTimer({ detail: { timer: this.ghostFlashTimer } });
      this.resumeTimer({ detail: { timer: this.ghostCycleTimer } });
      this.resumeTimer({ detail: { timer: this.fruitTimer } });
      this.allowPacmanMovement = true;
      this.pacman.display = true;
      this.pacman.moving = true;
      e.detail.ghost.display = true;
      e.detail.ghost.moving = true;
      this.ghosts.forEach((ghost) => {
        const ghostRef = ghost;
        ghostRef.animate = true;
        ghostRef.pause(false);
        ghostRef.allowCollision = true;
      });
    }, pauseDuration);
  }
eatGhost ( e ) { const pauseDuration = 1000 ; const { position , measurement } = e . detail . ghost ; this . pauseTimer ( { detail : { timer : this . ghostFlashTimer } } ) ; this . pauseTimer ( { detail : { timer : this . ghostCycleTimer } } ) ; this . pauseTimer ( { detail : { timer : this . fruitTimer } } ) ; this . soundManager . play ( eatGhost ) ; this . scaredGhosts = this . scaredGhosts . filter ( ghost => ghost . name !== e . detail . ghost . name , ) ; this . eyeGhosts += 1 ; this . ghostCombo += 1 ; const comboPoints = this . determineComboPoints ( ) ; window . dispatchEvent ( new CustomEvent ( 'awardPoints' , { detail : { points : comboPoints , } , } ) , ) ; this . displayText ( position , comboPoints , pauseDuration , measurement ) ; this . allowPacmanMovement = false ; this . pacman . display = false ; this . pacman . moving = false ; e . detail . ghost . display = false ; e . detail . ghost . moving = false ; this . ghosts . forEach ( ( ghost ) => { const ghostRef = ghost ; ghostRef . animate = false ; ghostRef . pause ( true ) ; ghostRef . allowCollision = false ; } ) ; new Timer ( ( ) => { this . soundManager . setAmbience ( eyesSound ) ; this . resumeTimer ( { detail : { timer : this . ghostFlashTimer } } ) ; this . resumeTimer ( { detail : { timer : this . ghostCycleTimer } } ) ; this . resumeTimer ( { detail : { timer : this . fruitTimer } } ) ; this . allowPacmanMovement = true ; this . pacman . display = true ; this . pacman . moving = true ; e . detail . ghost . display = true ; e . detail . ghost . moving = true ; this . ghosts . forEach ( ( ghost ) => { const ghostRef = ghost ; ghostRef . animate = true ; ghostRef . pause ( false ) ; ghostRef . allowCollision = true ; } ) ; } , pauseDuration ) ; }
Upon eating a ghost, award points and temporarily pause movement
 @param {CustomEvent} e - Contains a target ghost object
Upon eating a ghost award points and temporarily pause movement @param { CustomEvent } e - Contains a target ghost object