home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / roam-and-protect.swf / scripts / DefineSprite_299 / frame_4 / DoAction.as
Encoding:
Text File  |  2005-09-29  |  2.6 KB  |  120 lines

  1. _X = _X + (speed * direct + _root.movevar);
  2. myx = _X;
  3. myy = _Y;
  4. myw = _width * 0.5;
  5. myh = _height * 0.5;
  6. if(_root.restart eq "true")
  7. {
  8.    gotoAndStop("off");
  9.    play();
  10. }
  11. if(targon eq "false")
  12. {
  13.    if(myx > -1 * myw and myx < _root.stageW + myw)
  14.    {
  15.       listnum = _root.enlist.length;
  16.       _root.enlist[_root.enlist.length] = _name;
  17.       this._visible = 1;
  18.       targon = "true";
  19.    }
  20. }
  21. else
  22. {
  23.    this;
  24.    if(hitTest(_root.chopper))
  25.    {
  26.       _root.chopper.hits -= 5;
  27.       _root.chopper.chopper.field.gotoAndPlay(2);
  28.       if(myx > _root.playerX)
  29.       {
  30.          _root.chopper.xmove = -20;
  31.          _X = _X + 10;
  32.       }
  33.       else
  34.       {
  35.          _root.chopper.xmove = 20;
  36.          _X = _X - 10;
  37.       }
  38.       if(myy > _root.playerY)
  39.       {
  40.          _root.chopper.ymove = -20;
  41.          _Y = _Y + 10;
  42.       }
  43.       else
  44.       {
  45.          _root.chopper.ymove = 20;
  46.          _Y = _Y - 10;
  47.       }
  48.       hits -= 5;
  49.       power.gotoAndPlay(2);
  50.    }
  51.    if(myx < myw * -1 or myx > _root.stageW + myw)
  52.    {
  53.       _root.enlist.splice(listnum,1);
  54.       e = listnum;
  55.       e;
  56.       while(e < _root.enlist.length)
  57.       {
  58.          eval("_root." add _root.enlist[e]).listnum -= 1;
  59.          e++;
  60.       }
  61.       this._visible = 0;
  62.       targon = "false";
  63.    }
  64. }
  65. if(bombing eq "false")
  66. {
  67.    b += 1;
  68.    if(b > _root.entarglist.length - 1)
  69.    {
  70.       b = 0;
  71.    }
  72.    targ = _root.entarglist[b][0];
  73.    bombH = _root.entarglist[b][1];
  74.    if(myx < eval("_root." add targ)._x + 100 and myx > eval("_root." add targ)._x - 450)
  75.    {
  76.       bombing = "true";
  77.       bombcnt = 0;
  78.       bombvar = (bombH - _Y) * 0.1;
  79.       orgbombvar = bombvar;
  80.    }
  81. }
  82. else
  83. {
  84.    bombcnt += 1;
  85.    trace("BombCount= " + bombcnt);
  86.    if(bombcnt < 15)
  87.    {
  88.       _Y = _Y + 0.5;
  89.       bombvar *= 0.5;
  90.    }
  91.    else if(bombcnt == 15)
  92.    {
  93.       duplicateMovieClip(_root.bomb,"bomb" add mynum,16384 + (mynum + 100));
  94.       eval("_root.bomb" add mynum)._xscale *= direct;
  95.       eval("_root.bomb" add mynum)._x = myx;
  96.       eval("_root.bomb" add mynum)._y = myy;
  97.       eval("_root.bomb" add mynum).speed = speed;
  98.       eval("_root.bomb" add mynum).direct = direct;
  99.       eval("_root.bomb" add mynum).titan = "false";
  100.       eval("_root.bomb" add mynum).targ = targ.substring(0,4);
  101.       eval("_root.bomb" add mynum).gotoAndPlay(3);
  102.       bombvar = orgbombvar;
  103.    }
  104.    else if(bombcnt > 30)
  105.    {
  106.       _Y = _Y - 0.5;
  107.       bombvar *= 0.5;
  108.    }
  109. }
  110. if(hits < 0)
  111. {
  112.    _root.bombertocnt += 1;
  113.    gotoAndStop("explode");
  114.    play();
  115. }
  116. else
  117. {
  118.    gotoAndPlay(_currentframe - 1);
  119. }
  120.