home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / bigtruckadventures2.swf / scripts / DefineSprite_376 / frame_1 / DoAction.as
Encoding:
Text File  |  2008-09-04  |  2.6 KB  |  86 lines

  1. var layerColors = [10531979,11583901,12966573];
  2. i = 0;
  3. while(i < Math.floor(Stage.width / 10) + 2)
  4. {
  5.    if(i != 0)
  6.    {
  7.       p0.duplicateMovieClip("p" + i,i);
  8.       this["p" + i].cacheAsBitmap = true;
  9.    }
  10.    this["p" + i].xoff = i * 10;
  11.    this["p" + i].tileUpdated = true;
  12.    i++;
  13. }
  14. y = 0;
  15. last_y = 0;
  16. this.onEnterFrame = function()
  17. {
  18.    if(!_global.graphicsOptSet[1])
  19.    {
  20.       return undefined;
  21.    }
  22.    _Y = (- _root.scroll_y) / 2;
  23.    i = 0;
  24.    while(i < Math.floor(Stage.width / 10) + 2)
  25.    {
  26.       if(this["p" + i].xoff - _root.scroll_x / 2 < -10)
  27.       {
  28.          this["p" + i].xoff += (Math.floor(Stage.width / 10) + 2) * 10;
  29.          this["p" + i].tileUpdated = true;
  30.       }
  31.       if(this["p" + i].xoff - _root.scroll_x / 2 > (Math.floor(Stage.width / 10) + 1) * 10)
  32.       {
  33.          this["p" + i].xoff -= (Math.floor(Stage.width / 10) + 2) * 10;
  34.          this["p" + i].tileUpdated = true;
  35.       }
  36.       if(this["p" + i].tileUpdated)
  37.       {
  38.          if(_root.scroll_x)
  39.          {
  40.             this["p" + i].tileUpdated = false;
  41.          }
  42.          x = i * 10 - _root.scroll_x / 2 % 10;
  43.          last_y = y;
  44.          y = _root.getGroundHeight(this["p" + i].xoff * 2) / 2;
  45.          nextY = _root.getGroundHeight(this["p" + i].xoff * 2 + 20) / 2 - y;
  46.          n = Math.floor(Math.floor(this["p" + i].xoff * 2 / 10));
  47.          this["p" + i]._y = y;
  48.          bgDraw = this["p" + i];
  49.          bgDraw.clear();
  50.          if(_global.graphicsOptSet[3])
  51.          {
  52.             j = 0;
  53.             while(j <= 2)
  54.             {
  55.                Nj = 2 - j;
  56.                bgDraw.beginFill(layerColors[j]);
  57.                bgDraw.moveTo(0,Math.max(0,_root.SurfaceLayer[n] - j) * (Nj * 25));
  58.                bgDraw.lineTo(11,nextY + Math.max(0,_root.SurfaceLayer[n + 2] - j) * (Nj * 25));
  59.                if(j == 0)
  60.                {
  61.                   bgDraw.lineTo(11,500);
  62.                   bgDraw.lineTo(0,500);
  63.                }
  64.                else
  65.                {
  66.                   bgDraw.lineTo(11,nextY + Math.max(0,_root.SurfaceLayer[n + 2] - j + 1) * ((Nj + 1) * 25));
  67.                   bgDraw.lineTo(0,Math.max(0,_root.SurfaceLayer[n] - j + 1) * ((Nj + 1) * 25));
  68.                }
  69.                j++;
  70.             }
  71.          }
  72.          else
  73.          {
  74.             bgDraw.beginFill(layerColors[0]);
  75.             bgDraw.moveTo(0,0);
  76.             bgDraw.lineTo(11,nextY + _root.SurfaceLayer[n + 2]);
  77.             bgDraw.lineTo(11,500);
  78.             bgDraw.lineTo(0,500);
  79.          }
  80.          bgDraw.endFill();
  81.       }
  82.       this["p" + i]._x = this["p" + i].xoff - _root.scroll_x / 2;
  83.       i++;
  84.    }
  85. };
  86.