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

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