home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / airfox.swf / scripts / frame_9 / DoAction.as
Encoding:
Text File  |  2006-06-13  |  9.8 KB  |  397 lines

  1. if(Key.isDown(39))
  2. {
  3.    if(_root.dragger._x < 290)
  4.    {
  5.       _root.dragger._x += 4;
  6.    }
  7.    if(_root.dragger._rotation < 15)
  8.    {
  9.       _root.dragger._rotation = _root.dragger._rotation + 1;
  10.    }
  11.    if(60 >= frame_play)
  12.    {
  13.       frame_play += 2;
  14.    }
  15. }
  16. else if(Key.isDown(37))
  17. {
  18.    if(-15 < _root.dragger._rotation)
  19.    {
  20.       _root.dragger._rotation--;
  21.    }
  22.    if(10 < _root.dragger._x)
  23.    {
  24.       _root.dragger._x -= 4;
  25.    }
  26.    if(frame_play >= 20)
  27.    {
  28.       frame_play -= 2;
  29.    }
  30. }
  31. else
  32. {
  33.    if(0 < _root.dragger._rotation)
  34.    {
  35.       _root.dragger._rotation--;
  36.    }
  37.    if(_root.dragger._rotation < 0)
  38.    {
  39.       _root.dragger._rotation = _root.dragger._rotation + 1;
  40.    }
  41.    if(frame_play < 40)
  42.    {
  43.       frame_play += 2;
  44.    }
  45.    if(40 < frame_play)
  46.    {
  47.       frame_play -= 2;
  48.    }
  49. }
  50. if(Key.isDown(40))
  51. {
  52.    if(_root.dragger._y < 290)
  53.    {
  54.       _root.dragger._y += 4;
  55.    }
  56. }
  57. else if(Key.isDown(38))
  58. {
  59.    if(10 < _root.dragger._y)
  60.    {
  61.       _root.dragger._y -= 4;
  62.    }
  63. }
  64. tellTarget(_root.ship)
  65. {
  66.    gotoAndStop(_root.frame_play);
  67. }
  68. overlay.firepowercount = bonuscountdown;
  69. if(showbonus == 1)
  70. {
  71.    setProperty(_root.bonus, _X, _root.ship._x);
  72.    setProperty(_root.bonus, _Y, _root.ship._y + 20);
  73. }
  74. if(showbonus == 1)
  75. {
  76.    bonuscount++;
  77. }
  78. if(bonuscount >= 75)
  79. {
  80.    bonuscount = 0;
  81.    showbonus = 0;
  82.    _root.bonus.bonusdisplay = "";
  83.    setProperty(_root.bonus, _X, -100);
  84.    setProperty(_root.bonus, _Y, -100);
  85. }
  86. makebubble = random(50);
  87. if(makebubble == 1)
  88. {
  89.    bubbletotal++;
  90.    duplicateMovieClip(_root.bubble,"b" + bubbletotal,16384 + bubbletotal);
  91.    setProperty("_root.b" + bubbletotal, _X, random(300));
  92.    setProperty("_root.b" + bubbletotal, _Y, random(300));
  93.    setbubblesize = random(50) + 50;
  94.    setProperty("_root.b" + bubbletotal, _xscale, setbubblesize);
  95.    setProperty("_root.b" + bubbletotal, _yscale, setbubblesize);
  96.    if(100 < bubbletotal)
  97.    {
  98.       bubble = 50;
  99.    }
  100. }
  101. potx = getProperty(ship, _X);
  102. posx = getProperty(dragger, _X);
  103. posy = getProperty(dragger, _Y);
  104. poty = getProperty(ship, _Y);
  105. difx = posx - potx;
  106. dify = posy - poty;
  107. call("placement");
  108. if(_root.displaycount == 0)
  109. {
  110.    shippause++;
  111. }
  112. if(shipcount < 4)
  113. {
  114.    remove = 0;
  115.    while(15500 >= remove)
  116.    {
  117.       duplicateMovieClip(_root.filler,remove,16384 + remove);
  118.       removeMovieClip("_root." + remove);
  119.       remove++;
  120.    }
  121.    gotoAndPlay(2);
  122. }
  123. if(shippause == 100)
  124. {
  125.    duplicateMovieClip(_root.dockingship1,"dockingship",30383);
  126.    setProperty(_root.dockingship, _Y, -150);
  127.    setProperty(_root.dockingship, _X, 150);
  128. }
  129. if(displaycount == 0 && 250 < _root.dockingship._y)
  130. {
  131.    shield = 1;
  132.    icondepth = 14010;
  133.    placeiconx = 0;
  134.    s = 0;
  135.    while(_root.shipcount + 1 >= s)
  136.    {
  137.       icondepth++;
  138.       removeMovieClip("_root.icon" + icondepth);
  139.       s++;
  140.    }
  141.    placeiconx = -8;
  142.    icondepth = 14010;
  143.    s = 1;
  144.    while(_root.shipcount >= s)
  145.    {
  146.       icondepth++;
  147.       placeiconx += 20;
  148.       duplicateMovieClip(_root.shipicon,"icon" + icondepth,16384 + icondepth);
  149.       setProperty("_root.icon" + icondepth, _X, placeiconx);
  150.       setProperty("_root.icon" + icondepth, _Y, 8);
  151.       s++;
  152.    }
  153.    displaycount = 1;
  154.    shippause = 0;
  155. }
  156. if(shield == 1)
  157. {
  158.    shieldcounter++;
  159. }
  160. if(shieldcounter >= shielduration)
  161. {
  162.    shield = 0;
  163.    shieldcounter = 0;
  164. }
  165. makeatrain = random(400);
  166. if(makeatrain == 1 && allowtrain == 0 && shippause == 0)
  167. {
  168.    allowtrain = 1;
  169.    duplicateMovieClip(_root.trainengine,"train",17284);
  170. }
  171. if(allowtrain == 1)
  172. {
  173.    trainallowcount++;
  174. }
  175. if(trainallowcount >= 800)
  176. {
  177.    trainallowcount = 0;
  178.    allowtrain = 0;
  179. }
  180. count += _root.scrollspeed;
  181. if(gamepause < 200 && 0 < gamepause)
  182. {
  183.    setProperty(gamelevel, _X, 150);
  184.    setProperty(gamelevel, _Y, 100);
  185.    gamelevel.gameleveldisplay = gamelevelcount;
  186. }
  187. if(0 < gamepause)
  188. {
  189.    gamepause--;
  190. }
  191. else
  192. {
  193.    setProperty(gamelevel, _X, -150);
  194.    setProperty(gamelevel, _Y, -150);
  195. }
  196. if(0 >= gamepause)
  197. {
  198.    createlander = random(1000);
  199.    if(createlander == 1 && allowlander == 0)
  200.    {
  201.       allowlander = 1;
  202.       duplicateMovieClip(_root.lander,"lander1",29384);
  203.       setProperty(_root.lander1, _Y, -100);
  204.       setProperty(_root.lander1, _X, random(200) + 50);
  205.    }
  206.    makebonusship = random(1000);
  207.    if(makebonusship == 1 && allowbonusship == 0)
  208.    {
  209.       allowbonusship = 1;
  210.       duplicateMovieClip(_root.bonusship1,"bonusship",28384);
  211.       setProperty(_root.bonusship, _Y, -30);
  212.       setProperty(_root.bonusship, _X, random(200) + 50);
  213.       tellTarget(_root.bonusship)
  214.       {
  215.          creation = 0;
  216.          gotoAndStop(6);
  217.       }
  218.    }
  219.    makeenemy = random(100);
  220.    if(makeenemy == 1 && shippause == 0)
  221.    {
  222.       _root.enemycount = _root.enemycount + 1;
  223.       duplicateMovieClip(_root.enemy,"e" + _root.enemycount,16384 + _root.enemycount);
  224.       playenemy = random(50);
  225.       if(40 < playenemy)
  226.       {
  227.          tellTarget("_root.e" + _root.enemycount)
  228.          {
  229.             deathlevel = 0;
  230.             gotoAndStop(2);
  231.          }
  232.       }
  233.       else if(playenemy == 3)
  234.       {
  235.          tellTarget("_root.e" + _root.enemycount)
  236.          {
  237.             deathlevel = 2;
  238.             gotoAndStop(3);
  239.          }
  240.       }
  241.       else if(playenemy == 4)
  242.       {
  243.          tellTarget("_root.e" + _root.enemycount)
  244.          {
  245.             deathlevel = 1;
  246.             gotoAndStop(4);
  247.          }
  248.       }
  249.       else if(playenemy == 5)
  250.       {
  251.          tellTarget("_root.e" + _root.enemycount)
  252.          {
  253.             deathlevel = 3;
  254.             gotoAndStop(5);
  255.          }
  256.       }
  257.       else if(playenemy == 6)
  258.       {
  259.          tellTarget("_root.e" + _root.enemycount)
  260.          {
  261.             deathlevel = 2;
  262.             gotoAndStop(6);
  263.          }
  264.       }
  265.       else
  266.       {
  267.          tellTarget("_root.e" + _root.enemycount)
  268.          {
  269.             deathlevel = 0;
  270.             gotoAndStop(1);
  271.          }
  272.       }
  273.       if(_root.enemycount >= 4010)
  274.       {
  275.          _root.enemycount = 4000;
  276.       }
  277.    }
  278.    if(count >= 20)
  279.    {
  280.       islandcount++;
  281.       if(islandcreate >= islandcount)
  282.       {
  283.          i = 1;
  284.          while(15 >= i)
  285.          {
  286.             if(i >= islandx && islandx + islandwidth >= i)
  287.             {
  288.                totalcount++;
  289.                if(islandtype == 1)
  290.                {
  291.                   duplicateMovieClip(_root.terrain,totalcount,16384 + totalcount);
  292.                }
  293.                if(islandtype == 2)
  294.                {
  295.                   duplicateMovieClip(_root.terrain2,totalcount,16384 + totalcount);
  296.                }
  297.                setProperty("_root." + totalcount, _X, i * 20);
  298.                setProperty("_root." + totalcount, _Y, -120);
  299.                if(totalcount >= 1300)
  300.                {
  301.                   totalcount = 1000;
  302.                }
  303.                if(islandcount == 1 && i == islandx)
  304.                {
  305.                   tellTarget("_root." + totalcount)
  306.                   {
  307.                      gotoAndStop(1);
  308.                   }
  309.                }
  310.                else if(islandcount == 1 && islandx < i && i < islandx + islandwidth)
  311.                {
  312.                   tellTarget("_root." + totalcount)
  313.                   {
  314.                      gotoAndStop(2);
  315.                   }
  316.                }
  317.                else if(islandcount == 1 && i == islandx + islandwidth)
  318.                {
  319.                   tellTarget("_root." + totalcount)
  320.                   {
  321.                      gotoAndStop(3);
  322.                   }
  323.                }
  324.                else if(1 < islandcount && islandcount < islandcreate && i == islandx)
  325.                {
  326.                   tellTarget("_root." + totalcount)
  327.                   {
  328.                      gotoAndStop(4);
  329.                   }
  330.                }
  331.                else if(1 < islandcount && islandcount < islandcreate && i == islandx + islandwidth)
  332.                {
  333.                   tellTarget("_root." + totalcount)
  334.                   {
  335.                      gotoAndStop(5);
  336.                   }
  337.                }
  338.                else if(islandcount == islandcreate && i == islandx)
  339.                {
  340.                   tellTarget("_root." + totalcount)
  341.                   {
  342.                      gotoAndStop(6);
  343.                   }
  344.                }
  345.                else if(islandcount == islandcreate && islandx < i && i < islandx + islandwidth)
  346.                {
  347.                   tellTarget("_root." + totalcount)
  348.                   {
  349.                      gotoAndStop(7);
  350.                   }
  351.                }
  352.                else if(islandcount == islandcreate && i == islandx + islandwidth)
  353.                {
  354.                   tellTarget("_root." + totalcount)
  355.                   {
  356.                      gotoAndStop(8);
  357.                   }
  358.                }
  359.                else if(1 < islandcount && islandcount < islandcreate && islandx < i && i < islandx + islandwidth)
  360.                {
  361.                   tellTarget("_root." + totalcount)
  362.                   {
  363.                      gotoAndStop(9);
  364.                   }
  365.                }
  366.             }
  367.             i++;
  368.          }
  369.       }
  370.       if(islandcount >= islandpause)
  371.       {
  372.          totalislands++;
  373.          if(totalislands >= levelduration)
  374.          {
  375.             gamelevelcount++;
  376.             gamepause = 500;
  377.             increasespeed++;
  378.             if(increasespeed == 3)
  379.             {
  380.                scrollspeed += 0.2;
  381.                increasespeed = 0;
  382.             }
  383.             totalislands = 0;
  384.          }
  385.          tiletype = 1;
  386.          islandcreate = random(10) + 2;
  387.          islandtype = random(2) + 1;
  388.          islandpause = islandcreate + random(20) + 2;
  389.          islandx = random(11) + 1;
  390.          islandwidth = random(2) + 2;
  391.          islandcount = 0;
  392.       }
  393.       count = 0;
  394.    }
  395. }
  396. overlay.platformsremaining = levelduration - totalislands;
  397.