home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / free_mars.swf / scripts / frame_6 / DoAction_3.as < prev    next >
Encoding:
Text File  |  2006-06-13  |  16.1 KB  |  644 lines

  1. function SargDraft()
  2. {
  3.    attachMovie("sargeant","sargeant",2880);
  4.    _root.sargeant._x = 700;
  5.    _root.sargeant._y = 175;
  6.    _root.sargeant._xscale = 80;
  7.    _root.sargeant._yscale = 80;
  8.    ascent = int(Math(random) * 4);
  9.    dessent = 2;
  10. }
  11. function sargcolliz()
  12. {
  13.    attachMovie("Scolz","Scolz",21);
  14.    _root.Scolz._visible = false;
  15. }
  16. function sargboltload()
  17. {
  18.    attachMovie("SargBolt","SargBolt1",2885);
  19.    _root.SargBolt1._x = _root.sargeant._x - 24;
  20.    _root.SargBolt1._y = _root.sargeant._y - 28;
  21.    _root.SargBolt1._visible = false;
  22.    _root.SargBolt1._xscale = 185;
  23.    _root.SargBolt1._yscale = 185;
  24.    samocl = 0;
  25.    sloaddd = true;
  26.    again = int(Math.random() * 5);
  27. }
  28. function powerupper()
  29. {
  30.    attachMovie("healthupper","powerup",7689);
  31.    _root.powerup._visible = false;
  32.    _root.powerup._x = _root.sargeant._x;
  33.    _root.powerup._y = _root.sargeant._y;
  34.    _root.powerup._xscale = 27;
  35.    _root.powerup._yscale = 27;
  36. }
  37. function airmobleZ()
  38. {
  39.    _root.airmobl._x = int(Math.random() * 195 + 380);
  40.    _root.airmobl._y = -120;
  41.    _root.airmobl.gotoAndPlay(1);
  42.    airMO = int(Math.random() * 8 + 4);
  43.    Napo = 2;
  44.    _root.airmobl.rockit = 0;
  45.    _root.airmobl.swapDepths(3175);
  46. }
  47. function airmissload()
  48. {
  49.    _root.missile._xscale = 65;
  50.    _root.missile._yscale = 65;
  51.    _root.missile._x = _root.airmobl._x + 30;
  52.    _root.missile._y = _root.airmobl._y - 15;
  53.    _root.missile.swapDepths(3325);
  54. }
  55. function draftgrunt1()
  56. {
  57.    attachMovie("grunt","grunt1",4100);
  58.    _root.grunt1._x = 720;
  59.    _root.grunt1._y = 312;
  60.    starter = false;
  61.    snipertime = getTimer() + 2500;
  62.    aimfire = false;
  63.    _root.grunt1._xscale = 72;
  64.    _root.grunt1._yscale = 72;
  65.    onfield = false;
  66.    grunTime = 0;
  67.    velo = int(Math.random() * 5);
  68.    verto = int(Math.random() * 8);
  69.    upordown = int(Math.random() * 4);
  70.    _root.grunt1._visible = false;
  71.    _root.grunt1.swapDepths(4100);
  72. }
  73. function draftgrunt2()
  74. {
  75.    attachMovie("grunt","grunt2",3200);
  76.    _root.grunt2._x = 720;
  77.    _root.grunt2._y = 245;
  78.    Bstarter = false;
  79.    Bsnipertime = getTimer() + 2500;
  80.    Baimfire = false;
  81.    _root.grunt2._xscale = 68;
  82.    _root.grunt2._yscale = 68;
  83.    Bonfield = false;
  84.    BgrunTime = 0;
  85.    Bvelo = int(Math.random() * 5);
  86.    Bverto = int(Math.random() * 8);
  87.    Bupordown = int(Math.random() * 4);
  88.    _root.grunt2._visible = false;
  89. }
  90. function draftgrunt3()
  91. {
  92.    attachMovie("grunt","grunt3",2500);
  93.    _root.grunt3._x = 720;
  94.    _root.grunt3._y = 180;
  95.    starter = false;
  96.    Caimfire = false;
  97.    _root.grunt3._xscale = 65;
  98.    _root.grunt3._yscale = 65;
  99.    Confield = false;
  100.    CgrunTime = 0;
  101.    Cvelo = int(Math.random() * 5);
  102.    Cverto = int(Math.random() * 8);
  103.    Cupordown = int(Math.random() * 4);
  104.    _root.grunt3._visible = false;
  105. }
  106. function draftgrunt4()
  107. {
  108.    attachMovie("grunt","grunt4",2000);
  109.    _root.grunt4._x = 720;
  110.    _root.grunt4._y = 120;
  111.    Dstarter = false;
  112.    Dsnipertime = getTimer() + 2500;
  113.    Daimfire = false;
  114.    _root.grunt4._xscale = 63;
  115.    _root.grunt4._yscale = 63;
  116.    Donfield = false;
  117.    DgrunTime = 0;
  118.    Dvelo = int(Math.random() * 5);
  119.    Dverto = int(Math.random() * 8);
  120.    Dupordown = int(Math.random() * 4);
  121.    _root.grunt4._visible = false;
  122. }
  123. function draftgrunt5()
  124. {
  125.    attachMovie("grunt","grunt5",1000);
  126.    _root.grunt5._x = 720;
  127.    _root.grunt5._y = 80;
  128.    Estarter = false;
  129.    Esnipertime = getTimer() + 2500;
  130.    Eaimfire = false;
  131.    _root.grunt5._xscale = 60;
  132.    _root.grunt5._yscale = 60;
  133.    Eonfield = false;
  134.    EgrunTime = 0;
  135.    Evelo = int(Math.random() * 5);
  136.    Everto = int(Math.random() * 8);
  137.    Eupordown = int(Math.random() * 4);
  138.    _root.grunt5._visible = false;
  139. }
  140. function fiveshotload()
  141. {
  142.    attachMovie("gruntbolt","gruntbolt5",1900);
  143.    gruntbolt5._x = _root.grunt5._x - 60;
  144.    gruntbolt5._y = _root.grunt5._y - 8;
  145.    gruntbolt5.swapDepths(1900);
  146.    gruntbolt5._visible = false;
  147.    Efirenow = 0;
  148.    Eammoloaded = true;
  149.    Ereload = int(Math.random() * 5);
  150.    gruntbolt5._xscale = 84;
  151.    gruntbolt5._yscale = 84;
  152. }
  153. function airmobdeploy()
  154. {
  155.    if(_root.airmobl.rockit > 250 && _root.viza._currentframe <= 50)
  156.    {
  157.       _root.airmobl._x += Napo;
  158.       _root.airmobl._y += airMO;
  159.    }
  160.    if(_root.viza._currentframe > 50)
  161.    {
  162.       Napo = 0;
  163.       airMO = 0;
  164.    }
  165.    if(_root.airmobl._y <= 60)
  166.    {
  167.       airMO = int(Math.random() * 14 + 2);
  168.    }
  169.    if(_root.airmobl._y >= 320)
  170.    {
  171.       airMO *= -1;
  172.    }
  173.    if(_root.airmobl._x > 575)
  174.    {
  175.       Napo *= -1;
  176.    }
  177.    else if(_root.airmobl._x < 380)
  178.    {
  179.       Napo *= -1;
  180.    }
  181.    if(_root.airmobl._currentframe >= 14)
  182.    {
  183.       _root.airmobl._x = int(Math.random() * 195 + 380);
  184.       _root.airmobl._y = -120;
  185.       _root.airmobl.gotoAndPlay(1);
  186.       _root.airmobl.rockit = 0;
  187.    }
  188.    if(_root.airmobl._y < 0 && _root.vtol.deadlies == true)
  189.    {
  190.       _root.airmobl._x = int(Math.random() * 195 + 380);
  191.       _root.airmobl._y = -120;
  192.       _root.airmobl.gotoAndPlay(1);
  193.       _root.airmobl.rockit = 0;
  194.    }
  195.    if(_root.airmobl._y < 0 && _root.maus.happy == true)
  196.    {
  197.       _root.airmobl._x = int(Math.random() * 195 + 380);
  198.       _root.airmobl._y = -120;
  199.       _root.airmobl.gotoAndPlay(1);
  200.       _root.airmobl.rockit = 0;
  201.    }
  202.    _root.airmobl.rockit = _root.airmobl.rockit + 1;
  203. }
  204. function airmocolliz()
  205. {
  206.    _root.airCoz._x = _root.airmobl._x;
  207.    _root.airCoz._y = _root.airmobl._y;
  208.    _root.airCoz._yscale = 97;
  209.    _root.airCoz._visible = false;
  210. }
  211. function airmisLock()
  212. {
  213.    timetolaunch = getTimer() + 4000;
  214.    if(timetolaunch <= getTimer() || _root.missile._x < -200)
  215.    {
  216.       _root.missile._x = _root.airmobl._x + 30;
  217.       _root.missile._y = _root.airmobl._y - 15;
  218.       _root.missile.gotoAndPlay(1);
  219.    }
  220.    if(_root.airmobl._x >= 2 && timetolaunch >= getTimer())
  221.    {
  222.       _root.missile._x -= 30;
  223.       timetolaunch = getTimer() + int(Math.random() * 1966 + 2500);
  224.    }
  225. }
  226. function SargDeploy()
  227. {
  228.    _root.sargeant._x -= 3;
  229.    if(ascent <= 2)
  230.    {
  231.       _root.sargeant._y += dessent;
  232.    }
  233.    else
  234.    {
  235.       _root.sargeant._y -= dessent;
  236.    }
  237.    if(_root.sargeant._y < 80 || _root.sargeant._y > 320)
  238.    {
  239.       dessent *= -1;
  240.    }
  241.    if(_root.sargeant._x < -120 && _root.viza._currentframe <= 50)
  242.    {
  243.       _root.sargeant._x = -120;
  244.       holding = int(Math.random() * 800);
  245.       if(holding < 5)
  246.       {
  247.          _root.sargeant._x = 700;
  248.          _root.sargeant.gotoAndPlay(1);
  249.       }
  250.    }
  251.    holding--;
  252. }
  253. function sargcolbox()
  254. {
  255.    if(_root.sargeant._visible == true && _root.sargeant._x <= 700)
  256.    {
  257.       _root.Scolz._x = _root.sargeant._x;
  258.       _root.Scolz._y = _root.sargeant._y;
  259.    }
  260.    else
  261.    {
  262.       _root.Scolz._x = 720;
  263.       _root.Scolz._y = 188;
  264.    }
  265. }
  266. function sargboltfire()
  267. {
  268.    if(sloadd == true && _root.SargBolt1._visible == false)
  269.    {
  270.       _root.SargBolt1._x = _root.sargeant._x - 24;
  271.       _root.SargBolt1._y = _root.sargeant._y - 28;
  272.    }
  273.    else
  274.    {
  275.       _root.SargBolt1._visible == true && sloadd == false;
  276.    }
  277.    _root.SargBolt1._x -= 45;
  278.    if(_root.SargBolt1._x <= -55)
  279.    {
  280.       sloadd = true;
  281.       _root.SargBolt1._visible = false;
  282.    }
  283.    if(samocl >= 30 && _root.sargeant._x >= 80 && _root.sargeant._x <= 650 && _root.sargeant._currentframe < 7)
  284.    {
  285.       _root.SargBolt1._x = _root.sargeant._x - 24;
  286.       _root.SargBolt1._y = _root.sargeant._y - 28;
  287.       sloadd = false;
  288.       _root.SargBolt1._visible = true;
  289.       _root.SargBolt1.gotoAndPlay(1);
  290.       if(again <= 2)
  291.       {
  292.          samocl = 0;
  293.       }
  294.       if(again == 3)
  295.       {
  296.          samocl = int(Math.random() * 15) * -1;
  297.       }
  298.       if(again >= 4)
  299.       {
  300.          samocl = int(Math.random() * 20);
  301.       }
  302.    }
  303.    samocl++;
  304. }
  305. function powerhealth()
  306. {
  307.    _root.powerup._x = _root.sargeant._x;
  308.    _root.powerup._y = _root.sargeant._y;
  309.    if(_root.powerup._x <= -50)
  310.    {
  311.       _root.powerup._visible = false;
  312.    }
  313. }
  314. function deployGrunt1()
  315. {
  316.    if(grunTime > 45)
  317.    {
  318.       if(Math.random() < 0.08 && onfield == false)
  319.       {
  320.          starter = true;
  321.          onfield = true;
  322.       }
  323.       if((starter = true) && (onfield = true))
  324.       {
  325.          _root.grunt1._visible = true;
  326.          _root.grunt1._x -= 6 + velo;
  327.          gruntTime = 0;
  328.          if(_root.grunt1._x >= 0 && _root.grunt1._x <= 655)
  329.          {
  330.             aimfire = true;
  331.          }
  332.          if(upordown == 1 || upordown == 0)
  333.          {
  334.             _root.grunt1._y += 0;
  335.          }
  336.          if(upordown == 2)
  337.          {
  338.             _root.grunt1._y += verto;
  339.          }
  340.          if(upordown >= 3)
  341.          {
  342.             _root.grunt1._y -= verto;
  343.          }
  344.          if(_root.grunt1._y > 320)
  345.          {
  346.             upordown = 3;
  347.          }
  348.          if(_root.grunt1._y < 65)
  349.          {
  350.             upordown = 2;
  351.          }
  352.       }
  353.    }
  354.    if(_root.grunt1._x < -100 && _root.viza._currentframe <= 50)
  355.    {
  356.       starter = false;
  357.       onfield = false;
  358.       _root.grunt1._x = 720;
  359.       _root.grunt1._y = 312;
  360.       grunTime = 0;
  361.       velo = int(Math.random() * 5);
  362.       verto = int(Math.random() * 8);
  363.       upordown = int(Math.random() * 3);
  364.       _root.grunt1.gotoAndPlay(1);
  365.       _root.grunt1._visible = false;
  366.       aimfire == false;
  367.       _root.gruntbolt1.reload = int(Math.random() * 5);
  368.       _root.gruntCount = _root.gruntCount + 1;
  369.    }
  370.    grunTime++;
  371. }
  372. function deployGrunt2()
  373. {
  374.    if(BgrunTime > 30)
  375.    {
  376.       if(Math.random() < 0.08 && Bonfield == false)
  377.       {
  378.          Bstarter = true;
  379.          Bonfield = true;
  380.       }
  381.       if((Bstarter = true) && (Bonfield = true))
  382.       {
  383.          _root.grunt2._visible = true;
  384.          _root.grunt2._x -= 6 + Bvelo;
  385.          BgruntTime = 0;
  386.          if(_root.grunt2._x >= 0 && _root.grunt2._x <= 655)
  387.          {
  388.             Baimfire = true;
  389.          }
  390.          if(Bupordown == 1 || Bupordown == 0)
  391.          {
  392.             _root.grunt2._y += 0;
  393.          }
  394.          if(Bupordown == 2)
  395.          {
  396.             _root.grunt2._y += Bverto;
  397.          }
  398.          if(Bupordown >= 3)
  399.          {
  400.             _root.grunt2._y -= Bverto;
  401.          }
  402.          if(_root.grunt2._y > 320)
  403.          {
  404.             Bupordown = 3;
  405.          }
  406.          if(_root.grunt2._y < 65)
  407.          {
  408.             Bupordown = 2;
  409.          }
  410.       }
  411.    }
  412.    if(_root.grunt2._x < -100 && _root.viza._currentframe <= 50)
  413.    {
  414.       Bstarter = false;
  415.       Bonfield = false;
  416.       _root.grunt2._x = 720;
  417.       _root.grunt2._y = 245;
  418.       BgrunTime = 0;
  419.       Bvelo = int(Math.random() * 5);
  420.       Bverto = int(Math.random() * 8);
  421.       Bupordown = int(Math.random() * 3);
  422.       _root.grunt2.gotoAndPlay(1);
  423.       _root.grunt2._visible = false;
  424.       Baimfire == false;
  425.       _root.gruntbolt2.reload = int(Math.random() * 5);
  426.       _root.gruntCount = _root.gruntCount + 1;
  427.    }
  428.    BgrunTime++;
  429. }
  430. function deployGrunt3()
  431. {
  432.    if(CgrunTime > 25)
  433.    {
  434.       if(Math.random() < 0.08 && Confield == false)
  435.       {
  436.          Cstarter = true;
  437.          Confield = true;
  438.       }
  439.       if((Cstarter = true) && (Confield = true))
  440.       {
  441.          _root.grunt3._visible = true;
  442.          _root.grunt3._x -= 6 + Cvelo;
  443.          CgruntTime = 0;
  444.          if(_root.grunt3._x >= 0 && _root.grunt3._x <= 655)
  445.          {
  446.             Caimfire = true;
  447.          }
  448.          if(Cupordown == 1 || Cupordown == 0)
  449.          {
  450.             _root.grunt3._y += 0;
  451.          }
  452.          if(Cupordown == 2)
  453.          {
  454.             _root.grunt3._y += Cverto;
  455.          }
  456.          if(Cupordown >= 3)
  457.          {
  458.             _root.grunt3._y -= Cverto;
  459.          }
  460.          if(_root.grunt3._y > 320)
  461.          {
  462.             Cupordown = 3;
  463.          }
  464.          if(_root.grunt3._y < 65)
  465.          {
  466.             Cupordown = 2;
  467.          }
  468.       }
  469.    }
  470.    if(_root.grunt3._x < -100 && _root.viza._currentframe <= 50)
  471.    {
  472.       Cstarter = false;
  473.       Confield = false;
  474.       _root.grunt3._x = 720;
  475.       _root.grunt3._y = 180;
  476.       CgrunTime = 0;
  477.       Cvelo = int(Math.random() * 5);
  478.       Cverto = int(Math.random() * 8);
  479.       Cupordown = int(Math.random() * 3);
  480.       _root.grunt3.gotoAndPlay(1);
  481.       _root.grunt3._visible = false;
  482.       Caimfire == false;
  483.       _root.gruntbolt3.reload = int(Math.random() * 5);
  484.       _root.gruntCount = _root.gruntCount + 1;
  485.    }
  486.    CgrunTime++;
  487. }
  488. function deployGrunt4()
  489. {
  490.    if(DgrunTime > 55)
  491.    {
  492.       if(Math.random() < 0.08 && Donfield == false)
  493.       {
  494.          Dstarter = true;
  495.          Donfield = true;
  496.       }
  497.       if((Dstarter = true) && (Donfield = true))
  498.       {
  499.          _root.grunt4._visible = true;
  500.          _root.grunt4._x -= 6 + Dvelo;
  501.          DgruntTime = 0;
  502.          if(_root.grunt4._x >= 0 && _root.grunt4._x <= 655)
  503.          {
  504.             Daimfire = true;
  505.          }
  506.          if(Dupordown == 1 || Dupordown == 0)
  507.          {
  508.             _root.grunt4._y += 0;
  509.          }
  510.          if(Dupordown == 2)
  511.          {
  512.             _root.grunt4._y += Dverto;
  513.          }
  514.          if(Dupordown >= 3)
  515.          {
  516.             _root.grunt4._y -= Dverto;
  517.          }
  518.          if(_root.grunt4._y > 320)
  519.          {
  520.             Dupordown = 3;
  521.          }
  522.          if(_root.grunt4._y < 65)
  523.          {
  524.             Dupordown = 2;
  525.          }
  526.       }
  527.    }
  528.    if(_root.grunt4._x < -100 && _root.viza._currentframe <= 50)
  529.    {
  530.       Dstarter = false;
  531.       Donfield = false;
  532.       _root.grunt4._x = 720;
  533.       _root.grunt4._y = 120;
  534.       DgrunTime = 0;
  535.       Dvelo = int(Math.random() * 5);
  536.       Dverto = int(Math.random() * 8);
  537.       Dupordown = int(Math.random() * 3);
  538.       Dredeploy = false;
  539.       _root.grunt4.gotoAndPlay(1);
  540.       _root.grunt4._visible = false;
  541.       Daimfire == false;
  542.       _root.gruntbolt4.reload = int(Math.random() * 5);
  543.       _root.gruntCount = _root.gruntCount + 1;
  544.    }
  545.    DgrunTime++;
  546. }
  547. function deployGrunt5()
  548. {
  549.    if(EgrunTime > 30)
  550.    {
  551.       if(Math.random() < 0.08 && Eonfield == false)
  552.       {
  553.          Estarter = true;
  554.          Eonfield = true;
  555.       }
  556.       if((Estarter = true) && (Eonfield = true))
  557.       {
  558.          _root.grunt5._visible = true;
  559.          _root.grunt5._x -= 6 + Evelo;
  560.          EgruntTime = 0;
  561.          if(_root.grunt5._x >= 0 && _root.grunt5._x <= 655)
  562.          {
  563.             Eaimfire = true;
  564.          }
  565.          if(Eupordown == 1 || Eupordown == 0)
  566.          {
  567.             _root.grunt5._y += 0;
  568.          }
  569.          if(Eupordown == 2)
  570.          {
  571.             _root.grunt5._y += Everto;
  572.          }
  573.          if(Eupordown >= 3)
  574.          {
  575.             _root.grunt5._y -= Everto;
  576.          }
  577.          if(_root.grunt5._y > 320)
  578.          {
  579.             Eupordown = 3;
  580.          }
  581.          if(_root.grunt5._y < 65)
  582.          {
  583.             Eupordown = 2;
  584.          }
  585.       }
  586.    }
  587.    if(_root.grunt5._x < -100 && _root.viza._currentframe <= 50)
  588.    {
  589.       Estarter = false;
  590.       Eonfield = false;
  591.       _root.grunt5._x = 720;
  592.       _root.grunt5._y = 80;
  593.       EgrunTime = 0;
  594.       Evelo = int(Math.random() * 5);
  595.       Everto = int(Math.random() * 8);
  596.       Eupordown = int(Math.random() * 3);
  597.       _root.grunt5.gotoAndPlay(1);
  598.       _root.grunt5._visible = false;
  599.       Eaimfire == false;
  600.       _root.gruntbolt5.reload = int(Math.random() * 5);
  601.       _root.gruntCount = _root.gruntCount + 1;
  602.    }
  603.    EgrunTime++;
  604. }
  605. function fivegrfire()
  606. {
  607.    if(Eammoloaded == true && gruntbolt5._visible == false)
  608.    {
  609.       gruntbolt5._x = _root.grunt5._x - 60;
  610.       gruntbolt5._y = _root.grunt5._y - 8;
  611.    }
  612.    else
  613.    {
  614.       gruntbolt5._visible == true && Eammoloaded == false;
  615.    }
  616.    gruntbolt5._x -= 30;
  617.    if(gruntbolt5._x <= -55)
  618.    {
  619.       Eammoloaded = true;
  620.       gruntbolt5._visible = false;
  621.    }
  622.    if(Efirenow >= 30 && _root.grunt5._x >= 80 && _root.grunt5._x <= 650 && _root.grunt5._currentframe < 4 && gruntbolt5._visible == false)
  623.    {
  624.       gruntbolt5._x = _root.grunt5._x - 60;
  625.       gruntbolt5._y = _root.grunt5._y - 8;
  626.       Eammoloaded = false;
  627.       gruntbolt5._visible = true;
  628.       gruntbolt5.gotoAndPlay(1);
  629.       if(Ereload <= 2)
  630.       {
  631.          Efirenow = 0;
  632.       }
  633.       if(Ereload == 3)
  634.       {
  635.          Efirenow = int(Math.random() * 15) * -1;
  636.       }
  637.       if(Ereload >= 4)
  638.       {
  639.          Efirenow = int(Math.random() * 20);
  640.       }
  641.    }
  642.    Efirenow++;
  643. }
  644.