function() {
    var dir = game.player.dir;
    var sky = game.map.skybox;
    var ambient = game.map.light;
    var width = sky.width * (this.height / sky.height) * 2;
    var left = (dir / circle) * -width;

    ctx.save();
    ctx.drawImage(sky.image, left, 0, width, this.height);
    if (left < width - this.width) {
      ctx.drawImage(sky.image, left + width, 0, width, this.height);
    }
    if (ambient > 0) {
      ctx.fillStyle = '#fff';
      ctx.globalAlpha = ambient * 0.1;
      ctx.fillRect(0, this.height * 0.5, this.width, this.height * 0.5);
    }
    ctx.restore();
  }
function() {
    var dir = game.player.dir;
    var sky = game.map.skybox;
    var ambient = game.map.light;
    var width = sky.width * (this.height / sky.height) * 2;
    var left = (dir / circle) * -width;

    ctx.save();
    ctx.drawImage(sky.image, left, 0, width, this.height);
    if (left < width - this.width) {
      ctx.drawImage(sky.image, left + width, 0, width, this.height);
    }
    if (ambient > 0) {
      ctx.fillStyle = '#fff';
      ctx.globalAlpha = ambient * 0.1;
      ctx.fillRect(0, this.height * 0.5, this.width, this.height * 0.5);
    }
    ctx.restore();
  }
function ( ) { var dir = game . player . dir ; var sky = game . map . skybox ; var ambient = game . map . light ; var width = sky . width * ( this . height / sky . height ) * 2 ; var left = ( dir / circle ) * - width ; ctx . save ( ) ; ctx . drawImage ( sky . image , left , 0 , width , this . height ) ; if ( left < width - this . width ) { ctx . drawImage ( sky . image , left + width , 0 , width , this . height ) ; } if ( ambient > 0 ) { ctx . fillStyle = '#fff' ; ctx . globalAlpha = ambient * 0.1 ; ctx . fillRect ( 0 , this . height * 0.5 , this . width , this . height * 0.5 ) ; } ctx . restore ( ) ; }
Draw the skybox based on the player's direction.
Draw the skybox based on the player s direction .
draw the skybox