home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / dragonforce.swf / scripts / frame_2 / DoAction.as < prev   
Encoding:
Text File  |  2006-06-13  |  1.6 KB  |  62 lines

  1. function createStarField()
  2. {
  3.    var depthOffset = 15;
  4.    var i = depthOffset;
  5.    var gutter = 0;
  6.    var layer1PlayHead = 1;
  7.    var layer2PlayHead = 9;
  8.    var layer3PlayHead = 17;
  9.    while(--i)
  10.    {
  11.       playField.attachMovie("stars","starsLayer3" + i,_root.depth);
  12.       _root.depth = _root.depth + 1;
  13.       tellTarget(playField["starsLayer3" + i])
  14.       {
  15.          _X = Math.floor(Math.random() * 700);
  16.          _Y = gutter;
  17.          gotoAndPlay(layer3PlayHead);
  18.       }
  19.       if(++layer3PlayHead == 23)
  20.       {
  21.          layer3PlayHead = 17;
  22.       }
  23.       gutter += 11;
  24.       playField.attachMovie("stars","starsLayer2" + i,_root.depth);
  25.       _root.depth = _root.depth + 1;
  26.       tellTarget(playField["starsLayer2" + i])
  27.       {
  28.          _X = Math.floor(Math.random() * 700);
  29.          _Y = gutter;
  30.          gotoAndPlay(layer2PlayHead);
  31.       }
  32.       if(++layer2PlayHead == 16)
  33.       {
  34.          layer2PlayHead = 9;
  35.       }
  36.       gutter += 11;
  37.       playField.attachMovie("stars","starsLayer1" + i,_root.depth);
  38.       _root.depth = _root.depth + 1;
  39.       tellTarget(playField["starsLayer1" + i])
  40.       {
  41.          _X = Math.floor(Math.random() * 700);
  42.          _Y = gutter;
  43.          gotoAndPlay(layer1PlayHead);
  44.       }
  45.       if(++layer1PlayHead == 8)
  46.       {
  47.          layer1PlayHead = 0;
  48.       }
  49.       gutter += 11;
  50.    }
  51.    _root.ship.swapDepths(31);
  52. }
  53. function init()
  54. {
  55.    var t = this.createEmptyMovieClip("playField",_root.depth);
  56.    _root.depth = _root.depth + 1;
  57.    t._x = 0;
  58.    t._y = 16;
  59.    createStarField();
  60. }
  61. _root.depth = 2;
  62.