build/app.js
/**
   * Loop which periodically checks which pickups are nearby Pacman.
   * Pickups which are far away will not be considered for collision detection.
   */
Loop which periodically checks which pickups are nearby Pacman.
Pickups which are far away will not be considered for collision detection.
Loop which periodically checks which pickups are nearby Pacman . Pickups which are far away will not be considered for collision detection .
collisionDetectionLoop() {
    if (this.pacman.position) {
      const maxDistance = this.pacman.velocityPerMs * 750;
      const pacmanCenter = {
        x: this.pacman.position.left + this.scaledTileSize,
        y: this.pacman.position.top + this.scaledTileSize,
      };
      const debugging = false;
      this.pickups.forEach((pickup) => {
        pickup.checkPacmanProximity(maxDistance, pacmanCenter, debugging);
      });
    }
  }
collisionDetectionLoop ( ) { if ( this . pacman . position ) { const maxDistance = this . pacman . velocityPerMs * 750 ; const pacmanCenter = { x : this . pacman . position . left + this . scaledTileSize , y : this . pacman . position . top + this . scaledTileSize , } ; const debugging = false ; this . pickups . forEach ( ( pickup ) => { pickup . checkPacmanProximity ( maxDistance , pacmanCenter , debugging ) ; } ) ; } }
Loop which periodically checks which pickups are nearby Pacman.
Loop which periodically checks which pickups are nearby Pacman .
// Set this flag to TRUE to see how two-phase collision detection works!