build/app.js
/**
   * Register listeners for various game sequences
   */
Register listeners for various game sequences
Register listeners for various game sequences
registerEventListeners() {
    window.addEventListener('keydown', this.handleKeyDown.bind(this));
    window.addEventListener('awardPoints', this.awardPoints.bind(this));
    window.addEventListener('deathSequence', this.deathSequence.bind(this));
    window.addEventListener('dotEaten', this.dotEaten.bind(this));
    window.addEventListener('powerUp', this.powerUp.bind(this));
    window.addEventListener('eatGhost', this.eatGhost.bind(this));
    window.addEventListener('restoreGhost', this.restoreGhost.bind(this));
    window.addEventListener('addTimer', this.addTimer.bind(this));
    window.addEventListener('removeTimer', this.removeTimer.bind(this));
    window.addEventListener('releaseGhost', this.releaseGhost.bind(this));
    const directions = ['up', 'down', 'left', 'right'];
    directions.forEach((direction) => {
      document
        .getElementById(`button-${direction}`)
        .addEventListener('touchstart', () => {
          this.changeDirection(direction);
        });
    });
  }
registerEventListeners ( ) { window . addEventListener ( 'keydown' , this . handleKeyDown . bind ( this ) ) ; window . addEventListener ( 'awardPoints' , this . awardPoints . bind ( this ) ) ; window . addEventListener ( 'deathSequence' , this . deathSequence . bind ( this ) ) ; window . addEventListener ( 'dotEaten' , this . dotEaten . bind ( this ) ) ; window . addEventListener ( 'powerUp' , this . powerUp . bind ( this ) ) ; window . addEventListener ( 'eatGhost' , this . eatGhost . bind ( this ) ) ; window . addEventListener ( 'restoreGhost' , this . restoreGhost . bind ( this ) ) ; window . addEventListener ( 'addTimer' , this . addTimer . bind ( this ) ) ; window . addEventListener ( 'removeTimer' , this . removeTimer . bind ( this ) ) ; window . addEventListener ( 'releaseGhost' , this . releaseGhost . bind ( this ) ) ; const directions = [ 'up' , 'down' , 'left' , 'right' ] ; directions . forEach ( ( direction ) => { document . getElementById ( ` ${ direction } ` ) . addEventListener ( 'touchstart' , ( ) => { this . changeDirection ( direction ) ; } ) ; } ) ; }
Register listeners for various game sequences
Register listeners for various game sequences