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

  1. _root.enemymove2 = function()
  2. {
  3.    var ec = _root.enemyarray.length - 1;
  4.    while(ec >= 0)
  5.    {
  6.       if(_root.enemyarray[ec].enemytypevar == "boss1")
  7.       {
  8.          if(_root.enemyarray[ec]._x == _root.enemyarray[ec].destx and _root.enemyarray[ec]._y == _root.enemyarray[ec].desty)
  9.          {
  10.             _root.boss1arrive = true;
  11.          }
  12.          if(_root.boss1arrive == true)
  13.          {
  14.             _root.enemyarray[ec].destx = random(300) + 300;
  15.             _root.enemyarray[ec].desty = random(300) + 100;
  16.             _root.boss1arrive = false;
  17.          }
  18.          if(Math.abs(_root.enemyarray[ec].destx - _root.enemyarray[ec]._x) > _root.boss1speed)
  19.          {
  20.             if(_root.enemyarray[ec]._x < _root.enemyarray[ec].destx)
  21.             {
  22.                _root.enemyarray[ec]._x += _root.boss1speed;
  23.             }
  24.             else
  25.             {
  26.                _root.enemyarray[ec]._x -= _root.boss1speed;
  27.             }
  28.          }
  29.          else
  30.          {
  31.             _root.enemyarray[ec]._x = _root.enemyarray[ec].destx;
  32.          }
  33.          if(Math.abs(_root.enemyarray[ec].desty - _root.enemyarray[ec]._y) > _root.boss1speed)
  34.          {
  35.             if(_root.enemyarray[ec]._y < _root.enemyarray[ec].desty)
  36.             {
  37.                _root.enemyarray[ec]._y += _root.boss1speed;
  38.             }
  39.             else
  40.             {
  41.                _root.enemyarray[ec]._y -= _root.boss1speed;
  42.             }
  43.          }
  44.          else
  45.          {
  46.             _root.enemyarray[ec]._y = _root.enemyarray[ec].desty;
  47.          }
  48.       }
  49.       else if(_root.enemyarray[ec].enemytypevar == "boss2")
  50.       {
  51.          if(_root.enemyarray[ec]._x < 700)
  52.          {
  53.             _root.bossready = true;
  54.          }
  55.          if(_root.enemyarray[ec]._x == _root.enemyarray[ec].destx and _root.enemyarray[ec]._y == _root.enemyarray[ec].desty)
  56.          {
  57.             _root.boss2arrive = true;
  58.          }
  59.          if(_root.boss2arrive == true)
  60.          {
  61.             _root.enemyarray[ec].destx = random(300) + 300;
  62.             _root.enemyarray[ec].desty = random(300) + 100;
  63.             _root.boss2arrive = false;
  64.          }
  65.          if(Math.abs(_root.enemyarray[ec].destx - _root.enemyarray[ec]._x) > 0.6 * _root.boss1speed)
  66.          {
  67.             if(_root.enemyarray[ec]._x < _root.enemyarray[ec].destx)
  68.             {
  69.                _root.enemyarray[ec]._x += 0.6 * _root.boss1speed;
  70.             }
  71.             else
  72.             {
  73.                _root.enemyarray[ec]._x -= 0.6 * _root.boss1speed;
  74.             }
  75.          }
  76.          else
  77.          {
  78.             _root.enemyarray[ec]._x = _root.enemyarray[ec].destx;
  79.          }
  80.          if(Math.abs(_root.enemyarray[ec].desty - _root.enemyarray[ec]._y) > 0.6 * _root.boss1speed)
  81.          {
  82.             if(_root.enemyarray[ec]._y < _root.enemyarray[ec].desty)
  83.             {
  84.                _root.enemyarray[ec]._y += 0.6 * _root.boss1speed;
  85.             }
  86.             else
  87.             {
  88.                _root.enemyarray[ec]._y -= 0.6 * _root.boss1speed;
  89.             }
  90.          }
  91.          else
  92.          {
  93.             _root.enemyarray[ec]._y = _root.enemyarray[ec].desty;
  94.          }
  95.       }
  96.       else if(_root.enemyarray[ec].enemytypevar == "boss3head")
  97.       {
  98.          _root.enemyarray[ec].diffx = int(_root.boss3x - _root.enemyarray[ec]._x);
  99.          _root.enemyarray[ec].diffy = int(_root.boss3y - _root.enemyarray[ec]._y);
  100.          if(_root.enemyarray[ec].diffx > 0 && _root.enemyarray[ec].diffy > 0)
  101.          {
  102.             _root.enemyarray[ec].quad = Number(4);
  103.          }
  104.          if(_root.enemyarray[ec].diffx < 0 && _root.enemyarray[ec].diffy > 0)
  105.          {
  106.             _root.enemyarray[ec].quad = Number(1);
  107.          }
  108.          if(_root.enemyarray[ec].diffx < 0 && _root.enemyarray[ec].diffy < 0)
  109.          {
  110.             _root.enemyarray[ec].quad = Number(2);
  111.          }
  112.          if(_root.enemyarray[ec].diffx > 0 && _root.enemyarray[ec].diffy < 0)
  113.          {
  114.             _root.enemyarray[ec].quad = Number(3);
  115.          }
  116.          _root.enemyarray[ec].abs_x = Math.abs(_root.enemyarray[ec].diffx);
  117.          _root.enemyarray[ec].abs_y = Math.abs(_root.enemyarray[ec].diffy);
  118.          _root.enemyarray[ec].tg = _root.enemyarray[ec].abs_y / _root.enemyarray[ec].abs_x;
  119.          _root.enemyarray[ec].maths = Math.atan(_root.enemyarray[ec].tg) * Number(180) / 3.141592653589793;
  120.          _root.enemyarray[ec].distance = Math.sqrt(_root.enemyarray[ec]._x - _root.boss3x ^ 2 + (_root.enemyarray[ec]._y - _root.boss3y) ^ 2);
  121.          if(_root.enemyarray[ec].quad == 1)
  122.          {
  123.             _root.enemyarray[ec].angle = Number(180) - Number(_root.enemyarray[ec].maths);
  124.          }
  125.          if(_root.enemyarray[ec].quad == 2)
  126.          {
  127.             _root.enemyarray[ec].angle = Number(180) + Number(_root.enemyarray[ec].maths);
  128.          }
  129.          if(_root.enemyarray[ec].quad == 3)
  130.          {
  131.             _root.enemyarray[ec].angle = Number(360) - Number(_root.enemyarray[ec].maths);
  132.          }
  133.          if(_root.enemyarray[ec].quad == 4)
  134.          {
  135.             _root.enemyarray[ec].angle = Number(_root.enemyarray[ec].maths);
  136.          }
  137.          if(_root.enemyarray[ec].angle <= 180)
  138.          {
  139.             if(_root.enemyarray[ec]._rotation + 180 >= _root.enemyarray[ec].angle)
  140.             {
  141.                _root.enemyarray[ec]._rotation += (_root.enemyarray[ec].angle - _root.enemyarray[ec]._rotation) / _root.boss3turndelay;
  142.             }
  143.             else if(_root.enemyarray[ec].angle >= _root.enemyarray[ec]._rotation)
  144.             {
  145.                _root.enemyarray[ec]._rotation += (_root.enemyarray[ec].angle - _root.enemyarray[ec]._rotation) / _root.boss3turndelay;
  146.             }
  147.             else
  148.             {
  149.                _root.enemyarray[ec]._rotation -= (_root.enemyarray[ec]._rotation - _root.enemyarray[ec].angle) / _root.boss3turndelay;
  150.             }
  151.          }
  152.          else if(_root.enemyarray[ec].angle > 180)
  153.          {
  154.             if(_root.enemyarray[ec].angle - 180 < _root.enemyarray[ec]._rotation)
  155.             {
  156.                if(_root.enemyarray[ec]._rotation < _root.enemyarray[ec].angle)
  157.                {
  158.                   _root.enemyarray[ec]._rotation += (_root.enemyarray[ec].angle - _root.enemyarray[ec]._rotation) / _root.boss3turndelay;
  159.                }
  160.                else
  161.                {
  162.                   _root.enemyarray[ec]._rotation -= (_root.enemyarray[ec]._rotation - _root.enemyarray[ec].angle) / _root.boss3turndelay;
  163.                }
  164.             }
  165.             else
  166.             {
  167.                _root.enemyarray[ec]._rotation -= (360 - (_root.enemyarray[ec].angle - _root.enemyarray[ec]._rotation)) / _root.boss3turndelay;
  168.             }
  169.          }
  170.          _root.enemyarray[ec].xmove = _root.boss3s * Math.cos(0.017453292519943295 * _root.enemyarray[ec]._rotation);
  171.          _root.enemyarray[ec].ymove = _root.boss3s * Math.sin(0.017453292519943295 * _root.enemyarray[ec]._rotation);
  172.          _root.enemyarray[ec]._x += _root.enemyarray[ec].xmove;
  173.          _root.enemyarray[ec]._y += _root.enemyarray[ec].ymove;
  174.          if(_root.enemyarray[ec].distance < 5)
  175.          {
  176.             if(_root.difficulty == "easy")
  177.             {
  178.                if(_root.boss3counter < _root.boss3xarray.length - 1)
  179.                {
  180.                   _root.boss3counter = _root.boss3counter + 1;
  181.                }
  182.                else
  183.                {
  184.                   _root.boss3counter = 0;
  185.                }
  186.                _root.boss3x = _root.boss3xarray[_root.boss3counter];
  187.                _root.boss3y = _root.boss3yarray[_root.boss3counter];
  188.                _root.boss3s = _root.boss3sarray[_root.boss3counter];
  189.                _root.boss3turndelay = _root.boss3turndelayarray[_root.boss3counter];
  190.             }
  191.             else if(_root.difficulty == "expert")
  192.             {
  193.                _root.boss3x = random(699) + 1;
  194.                _root.boss3y = random(499) + 1;
  195.                _root.boss3s = random(11) + 5;
  196.                _root.boss3turndelay = random(7) + 4;
  197.             }
  198.          }
  199.       }
  200.       else if(_root.enemyarray[ec].enemytypevar == "boss3body" or _root.enemyarray[ec].enemytypevar == "boss3tail")
  201.       {
  202.          _root.enemyarray[ec].offx = _root.enemyarray[ec - 1].enemytype.attachpoint._x * Math.cos(_root.enemyarray[ec - 1]._rotation * 3.141592653589793 / 180);
  203.          _root.enemyarray[ec].offy = _root.enemyarray[ec - 1].enemytype.attachpoint._x * Math.sin((- _root.enemyarray[ec - 1]._rotation) * 3.141592653589793 / 180);
  204.          _root.enemyarray[ec]._x = _root.enemyarray[ec - 1]._x + _root.enemyarray[ec - 1].enemytype._x + _root.enemyarray[ec].offx;
  205.          _root.enemyarray[ec]._y = _root.enemyarray[ec - 1]._y + _root.enemyarray[ec - 1].enemytype._y - _root.enemyarray[ec].offy;
  206.          _root.enemyarray[ec]._rotation += (_root.enemyarray[ec - 1]._rotation - _root.enemyarray[ec]._rotation) / 7;
  207.       }
  208.       else if(_root.enemyarray[ec].enemytypevar == "fboss")
  209.       {
  210.          if(_root.fbossrest == false)
  211.          {
  212.             if(_root.enemyarray[ec]._x == _root.enemyarray[ec].destx and _root.enemyarray[ec]._y == _root.enemyarray[ec].desty)
  213.             {
  214.                _root.fbossarrive = true;
  215.             }
  216.             if(_root.fbossarrive == true)
  217.             {
  218.                _root.enemyarray[ec].destx = random(300) + 300;
  219.                _root.enemyarray[ec].desty = random(300) + 100;
  220.                _root.fbossarrive = false;
  221.             }
  222.             if(Math.abs(_root.enemyarray[ec].destx - _root.enemyarray[ec]._x) > 0.6 * _root.boss1speed)
  223.             {
  224.                if(_root.enemyarray[ec]._x < _root.enemyarray[ec].destx)
  225.                {
  226.                   _root.enemyarray[ec]._x += 0.6 * _root.boss1speed;
  227.                }
  228.                else
  229.                {
  230.                   _root.enemyarray[ec]._x -= 0.6 * _root.boss1speed;
  231.                }
  232.             }
  233.             else
  234.             {
  235.                _root.enemyarray[ec]._x = _root.enemyarray[ec].destx;
  236.             }
  237.             if(Math.abs(_root.enemyarray[ec].desty - _root.enemyarray[ec]._y) > 0.6 * _root.boss1speed)
  238.             {
  239.                if(_root.enemyarray[ec]._y < _root.enemyarray[ec].desty)
  240.                {
  241.                   _root.enemyarray[ec]._y += 0.6 * _root.boss1speed;
  242.                }
  243.                else
  244.                {
  245.                   _root.enemyarray[ec]._y -= 0.6 * _root.boss1speed;
  246.                }
  247.             }
  248.             else
  249.             {
  250.                _root.enemyarray[ec]._y = _root.enemyarray[ec].desty;
  251.             }
  252.             _root.fbossrestcounter = _root.fbossrestcounter + 1;
  253.             if(_root.fbossrestcounter == _root.fbossresttime)
  254.             {
  255.                _root.fbossrestcounter = 0;
  256.                _root.fbossticker = 0;
  257.                _root.e1w1pos = _root.e2w1pos = _root.e3w1pos = _root.e4w1pos = _root.e4w2pos = _root.e5w1pos = _root.e6w1pos = _root.e7w1pos = 0;
  258.                if(_root.enemyarray[ec].health > 450 * _root.health)
  259.                {
  260.                   _root.fbosswave = 1;
  261.                }
  262.                else if(_root.enemyarray[ec].health > 350 * _root.health)
  263.                {
  264.                   _root.fbosswave = 2;
  265.                   _root.assignx = 800;
  266.                   _root.assigny = random(300) + 100;
  267.                   _root.healthpowerupfunction();
  268.                }
  269.                else if(_root.enemyarray[ec].health > 0)
  270.                {
  271.                   _root.fbosswave = 3;
  272.                }
  273.                _root.changeframes = true;
  274.                _root.assignx = 900;
  275.                _root.assigny = 250;
  276.                _root.minihealthpowerupfunction();
  277.                _root.fbossrest = true;
  278.             }
  279.          }
  280.          else
  281.          {
  282.             if(_root.enemyarray[ec]._x < 1500)
  283.             {
  284.                _root.enemyarray[ec]._x += 0.6 * _root.boss1speed;
  285.             }
  286.             if(_root.changeframes == true)
  287.             {
  288.                if(_root.enemyarray[ec]._x > 750 + _root.enemyarray[ec]._width)
  289.                {
  290.                   _root.enemyarray[ec].enemytype.gotoAndStop("blank");
  291.                   _root.changeframes = false;
  292.                }
  293.             }
  294.             _root.fbossrestcounter = _root.fbossrestcounter + 1;
  295.             if(_root.fbossrestcounter == 500)
  296.             {
  297.                _root.enemyarray[ec].enemytype.gotoAndStop("fboss");
  298.                _root.fbossrest = false;
  299.                _root.fbossresttime = 625;
  300.                _root.changeframes = true;
  301.                _root.fbossrestcounter = 0;
  302.                _root.fbossarrive = true;
  303.                _root.fbosswave = 0;
  304.             }
  305.          }
  306.          _root.fbossnumber = ec;
  307.       }
  308.       else if(_root.enemyarray[ec].enemytypevar == "launcher1")
  309.       {
  310.          _root.enemyarray[ec]._x = _root.enemyarray[_root.fbossnumber]._x + _root.enemyarray[_root.fbossnumber].enemytype._x + _root.enemyarray[_root.fbossnumber].enemytype.missile._x;
  311.          _root.enemyarray[ec]._y = _root.enemyarray[_root.fbossnumber]._y + _root.enemyarray[_root.fbossnumber].enemytype._y + _root.enemyarray[_root.fbossnumber].enemytype.missile._y;
  312.          if(_root.changeframes == true)
  313.          {
  314.             if(_root.fbossrest == true)
  315.             {
  316.                if(_root.enemyarray[ec]._x > 700 + _root.enemyarray[ec]._width)
  317.                {
  318.                   _root.enemyarray[ec].enemytype.gotoAndStop("blank");
  319.                }
  320.             }
  321.             else
  322.             {
  323.                _root.enemyarray[ec].enemytype.gotoAndStop("launcher");
  324.                if(ec == 1)
  325.                {
  326.                   _root.changeframes = false;
  327.                }
  328.             }
  329.          }
  330.       }
  331.       else if(_root.enemyarray[ec].enemytypevar == "launcher2")
  332.       {
  333.          _root.enemyarray[ec]._x = _root.enemyarray[_root.fbossnumber]._x + _root.enemyarray[_root.fbossnumber].enemytype._x + _root.enemyarray[_root.fbossnumber].enemytype.missile2._x;
  334.          _root.enemyarray[ec]._y = _root.enemyarray[_root.fbossnumber]._y + _root.enemyarray[_root.fbossnumber].enemytype._y + _root.enemyarray[_root.fbossnumber].enemytype.missile2._y;
  335.          if(_root.changeframes == true)
  336.          {
  337.             if(_root.fbossrest == true)
  338.             {
  339.                if(_root.enemyarray[ec]._x > 700 + _root.enemyarray[ec]._width)
  340.                {
  341.                   _root.enemyarray[ec].enemytype.gotoAndStop("blank");
  342.                }
  343.             }
  344.             else
  345.             {
  346.                _root.enemyarray[ec].enemytype.gotoAndStop("launcher");
  347.                if(ec == 1)
  348.                {
  349.                   _root.changeframes = false;
  350.                }
  351.             }
  352.          }
  353.       }
  354.       else if(_root.enemyarray[ec].enemytypevar == "launcher3")
  355.       {
  356.          _root.enemyarray[ec]._x = _root.enemyarray[_root.fbossnumber]._x + _root.enemyarray[_root.fbossnumber].enemytype._x + _root.enemyarray[_root.fbossnumber].enemytype.missile3._x;
  357.          _root.enemyarray[ec]._y = _root.enemyarray[_root.fbossnumber]._y + _root.enemyarray[_root.fbossnumber].enemytype._y + _root.enemyarray[_root.fbossnumber].enemytype.missile3._y;
  358.          if(_root.changeframes == true)
  359.          {
  360.             if(_root.fbossrest == true)
  361.             {
  362.                if(_root.enemyarray[ec]._x > 700 + _root.enemyarray[ec]._width)
  363.                {
  364.                   _root.enemyarray[ec].enemytype.gotoAndStop("blank");
  365.                }
  366.             }
  367.             else
  368.             {
  369.                _root.enemyarray[ec].enemytype.gotoAndStop("launcher");
  370.                if(ec == 1)
  371.                {
  372.                   _root.changeframes = false;
  373.                }
  374.             }
  375.          }
  376.       }
  377.       else if(_root.enemyarray[ec].enemytypevar == "launcher4")
  378.       {
  379.          _root.enemyarray[ec]._x = _root.enemyarray[_root.fbossnumber]._x + _root.enemyarray[_root.fbossnumber].enemytype._x + _root.enemyarray[_root.fbossnumber].enemytype.missile4._x;
  380.          _root.enemyarray[ec]._y = _root.enemyarray[_root.fbossnumber]._y + _root.enemyarray[_root.fbossnumber].enemytype._y + _root.enemyarray[_root.fbossnumber].enemytype.missile4._y;
  381.          if(_root.changeframes == true)
  382.          {
  383.             if(_root.fbossrest == true)
  384.             {
  385.                if(_root.enemyarray[ec]._x > 700 + _root.enemyarray[ec]._width)
  386.                {
  387.                   _root.enemyarray[ec].enemytype.gotoAndStop("blank");
  388.                }
  389.             }
  390.             else
  391.             {
  392.                _root.enemyarray[ec].enemytype.gotoAndStop("launcher");
  393.                if(ec == 1)
  394.                {
  395.                   _root.changeframes = false;
  396.                }
  397.             }
  398.          }
  399.       }
  400.       else if(_root.enemyarray[ec].enemytypevar == "rocket")
  401.       {
  402.          if(_root.enemyarray[ec]._x > 730 or _root.enemyarray[ec]._x < -30)
  403.          {
  404.             _root.enemyarray[ec].removeMovieClip();
  405.             _root.enemyarray.splice(ec,1);
  406.          }
  407.          if(_root.enemyarray[ec].deploy == true)
  408.          {
  409.             _root.enemyarray[ec]._rotation = _root.enemyarray[ec].angle * 180 / 3.141592653589793;
  410.             _root.enemyarray[ec]._x += _root.enemyarray[ec].speedx * Math.cos(_root.enemyarray[ec].angle);
  411.             _root.enemyarray[ec]._y += _root.enemyarray[ec].speedy * Math.sin(_root.enemyarray[ec].angle);
  412.             _root.enemyarray[ec].deploytimer = _root.enemyarray[ec].deploytimer + 1;
  413.             if(_root.enemyarray[ec].deploytimer == 15)
  414.             {
  415.                _root.enemyarray[ec].deploy = false;
  416.             }
  417.          }
  418.          else if(_root.enemyarray[ec].deploy == false)
  419.          {
  420.             _root.enemyarray[ec].diffx = int(_root.ship._x + _root.ship.shipmc._x - _root.enemyarray[ec]._x);
  421.             _root.enemyarray[ec].diffy = int(_root.ship._y + _root.ship.shipmc._y - _root.enemyarray[ec]._y);
  422.             if(_root.enemyarray[ec].diffx > 0 && _root.enemyarray[ec].diffy > 0)
  423.             {
  424.                _root.enemyarray[ec].quad = Number(4);
  425.             }
  426.             if(_root.enemyarray[ec].diffx < 0 && _root.enemyarray[ec].diffy > 0)
  427.             {
  428.                _root.enemyarray[ec].quad = Number(1);
  429.             }
  430.             if(_root.enemyarray[ec].diffx < 0 && _root.enemyarray[ec].diffy < 0)
  431.             {
  432.                _root.enemyarray[ec].quad = Number(2);
  433.             }
  434.             if(_root.enemyarray[ec].diffx > 0 && _root.enemyarray[ec].diffy < 0)
  435.             {
  436.                _root.enemyarray[ec].quad = Number(3);
  437.             }
  438.             _root.enemyarray[ec].abs_x = Math.abs(_root.enemyarray[ec].diffx);
  439.             _root.enemyarray[ec].abs_y = Math.abs(_root.enemyarray[ec].diffy);
  440.             _root.enemyarray[ec].tg = _root.enemyarray[ec].abs_y / _root.enemyarray[ec].abs_x;
  441.             _root.enemyarray[ec].maths = Math.atan(_root.enemyarray[ec].tg) * Number(180) / 3.141592653589793;
  442.             _root.enemyarray[ec].distance = Math.sqrt(_root.enemyarray[ec]._x - (_root.ship._x + _root.ship.shipmc._x) ^ 2 + (_root.enemyarray[ec]._y - (_root.ship._y + _root.ship.shipmc._y)) ^ 2);
  443.             if(_root.enemyarray[ec].quad == 1)
  444.             {
  445.                _root.enemyarray[ec].angle = Number(180) - Number(_root.enemyarray[ec].maths);
  446.             }
  447.             else if(_root.enemyarray[ec].quad == 2)
  448.             {
  449.                _root.enemyarray[ec].angle = Number(180) + Number(_root.enemyarray[ec].maths);
  450.             }
  451.             else if(_root.enemyarray[ec].quad == 3)
  452.             {
  453.                _root.enemyarray[ec].angle = Number(360) - Number(_root.enemyarray[ec].maths);
  454.             }
  455.             else if(_root.enemyarray[ec].quad == 4)
  456.             {
  457.                _root.enemyarray[ec].angle = Number(_root.enemyarray[ec].maths);
  458.             }
  459.             _root.enemyarray[ec].xmove = _root.enemyarray[ec].speedx * Math.cos(0.017453292519943295 * _root.enemyarray[ec].angle);
  460.             _root.enemyarray[ec].ymove = _root.enemyarray[ec].speedy * Math.sin(0.017453292519943295 * _root.enemyarray[ec].angle);
  461.             if(_root.enemyarray[ec].angle <= 180)
  462.             {
  463.                if(_root.enemyarray[ec]._rotation + 180 >= _root.enemyarray[ec].angle)
  464.                {
  465.                   _root.enemyarray[ec]._rotation += (_root.enemyarray[ec].angle - _root.enemyarray[ec]._rotation) / _root.enemyarray[ec].megahomingturndelay;
  466.                }
  467.                else if(_root.enemyarray[ec].angle >= _root.enemyarray[ec]._rotation)
  468.                {
  469.                   _root.enemyarray[ec]._rotation += (_root.enemyarray[ec].angle - _root.enemyarray[ec]._rotation) / _root.enemyarray[ec].megahomingturndelay;
  470.                }
  471.                else
  472.                {
  473.                   _root.enemyarray[ec]._rotation -= (_root.enemyarray[ec]._rotation - _root.enemyarray[ec].angle) / _root.enemyarray[ec].megahomingturndelay;
  474.                }
  475.             }
  476.             else if(_root.enemyarray[ec].angle > 180)
  477.             {
  478.                if(_root.enemyarray[ec].angle - 180 < _root.enemyarray[ec]._rotation)
  479.                {
  480.                   if(_root.enemyarray[ec]._rotation < _root.enemyarray[ec].angle)
  481.                   {
  482.                      _root.enemyarray[ec]._rotation += (_root.enemyarray[ec].angle - _root.enemyarray[ec]._rotation) / _root.enemyarray[ec].megahomingturndelay;
  483.                   }
  484.                   else
  485.                   {
  486.                      _root.enemyarray[ec]._rotation -= (_root.enemyarray[ec]._rotation - _root.enemyarray[ec].angle) / _root.enemyarray[ec].megahomingturndelay;
  487.                   }
  488.                }
  489.                else
  490.                {
  491.                   _root.enemyarray[ec]._rotation -= (360 - (_root.enemyarray[ec].angle - _root.enemyarray[ec]._rotation)) / _root.enemyarray[ec].megahomingturndelay;
  492.                }
  493.             }
  494.             _root.enemyarray[ec]._x += _root.enemyarray[ec].xmove;
  495.             _root.enemyarray[ec]._y += _root.enemyarray[ec].ymove;
  496.          }
  497.       }
  498.       else if(_root.enemyarray[ec].enemytypevar == "enemy1")
  499.       {
  500.          _root.enemyarray[ec]._x -= _root.enemy1speed;
  501.          _root.enemyarray[ec]._y += (_root.ship._y - (_root.enemyarray[ec]._y - _root.enemyarray[ec].enemytype._height)) / 25;
  502.       }
  503.       else if(_root.enemyarray[ec].enemytypevar == "enemy2")
  504.       {
  505.          _root.enemyarray[ec]._x -= _root.enemy1speed * 0.6666666666666666;
  506.          if(_root.enemyarray[ec].e2arrive != false)
  507.          {
  508.             _root.enemyarray[ec].nextpos = 500 - _root.enemyarray[ec]._y;
  509.             _root.enemyarray[ec].e2arrive = false;
  510.          }
  511.          else
  512.          {
  513.             _root.enemyarray[ec]._y += (_root.enemyarray[ec].nextpos - _root.enemyarray[ec]._y) / Math.abs(_root.enemyarray[ec].nextpos - _root.enemyarray[ec]._y) * (_root.enemy1speed / 2);
  514.             if(Math.abs(_root.enemyarray[ec].nextpos - _root.enemyarray[ec]._y) < 5)
  515.             {
  516.                _root.enemyarray[ec].e2arrive = true;
  517.             }
  518.          }
  519.       }
  520.       else if(_root.enemyarray[ec].enemytypevar == "enemy3")
  521.       {
  522.          _root.enemyarray[ec]._x -= _root.enemy1speed * 0.4;
  523.       }
  524.       else if(_root.enemyarray[ec].enemytypevar == "enemy4")
  525.       {
  526.          _root.enemyarray[ec]._y += (_root.enemyarray[ec].desty - _root.enemyarray[ec]._y) / 10;
  527.          _root.enemyarray[ec]._x -= _root.enemy1speed / 2;
  528.       }
  529.       else if(_root.enemyarray[ec].enemytypevar == "enemy4wave2")
  530.       {
  531.          if(_root.enemyarray[ec]._x == _root.enemyarray[ec].destx and _root.enemyarray[ec]._y == _root.enemyarray[ec].desty)
  532.          {
  533.             _root.enemyarray[ec].e4arrive = true;
  534.          }
  535.          if(_root.enemyarray[ec].e4arrive == true)
  536.          {
  537.             _root.enemyarray[ec].destx = random(300) + 300;
  538.             _root.enemyarray[ec].desty = random(300) + 100;
  539.             _root.enemyarray[ec].e4arrive = false;
  540.          }
  541.          if(Math.abs(_root.enemyarray[ec].destx - _root.enemyarray[ec]._x) > _root.boss1speed)
  542.          {
  543.             if(_root.enemyarray[ec]._x < _root.enemyarray[ec].destx)
  544.             {
  545.                _root.enemyarray[ec]._x += _root.boss1speed;
  546.             }
  547.             else
  548.             {
  549.                _root.enemyarray[ec]._x -= _root.boss1speed;
  550.             }
  551.          }
  552.          else
  553.          {
  554.             _root.enemyarray[ec]._x = _root.enemyarray[ec].destx;
  555.          }
  556.          if(Math.abs(_root.enemyarray[ec].desty - _root.enemyarray[ec]._y) > _root.boss1speed)
  557.          {
  558.             if(_root.enemyarray[ec]._y < _root.enemyarray[ec].desty)
  559.             {
  560.                _root.enemyarray[ec]._y += _root.boss1speed;
  561.             }
  562.             else
  563.             {
  564.                _root.enemyarray[ec]._y -= _root.boss1speed;
  565.             }
  566.          }
  567.          else
  568.          {
  569.             _root.enemyarray[ec]._y = _root.enemyarray[ec].desty;
  570.          }
  571.       }
  572.       else if(_root.enemyarray[ec].enemytypevar == "enemy5")
  573.       {
  574.          _root.enemyarray[ec]._x -= _root.enemy1speed / 4;
  575.          _root.enemyarray[ec].enemytype._rotation += 8;
  576.       }
  577.       else if(_root.enemyarray[ec].enemytypevar == "enemy6")
  578.       {
  579.          _root.enemyarray[ec]._x -= _root.enemy1speed / 3;
  580.       }
  581.       else if(_root.enemyarray[ec].enemytypevar == "enemy7")
  582.       {
  583.          _root.enemyarray[ec]._x -= _root.enemy1speed / 3.5;
  584.       }
  585.       ec--;
  586.    }
  587. };
  588.