home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Aventura / paranormality.swf / scripts / frame_214 / DoAction_2.as next >
Encoding:
Text File  |  2005-09-29  |  1.5 KB  |  58 lines

  1. function buzzflight(mcp)
  2. {
  3.    mcp.distx = _level0.dweeb._x - mcp._x;
  4.    mcp.disty = _level0.dweeb._y - (_level0.dweeb._height + 25) - mcp._y;
  5.    if(_level0.dweeb._x < mcp._x)
  6.    {
  7.       mcp._xscale = 100;
  8.       mcp.d = Math.tan(mcp.disty / mcp.distx);
  9.    }
  10.    else
  11.    {
  12.       mcp._xscale = -100;
  13.       mcp.d = Math.tan(mcp.disty / mcp.distx) - 180;
  14.    }
  15.    mcp.xstep = (- mcp.speed) * Math.cos(mcp.d);
  16.    mcp.ystep = mcp.speed * Math.sin(mcp.d);
  17.    if(mcp._y < _level0.dweeb._y)
  18.    {
  19.       mcp._x += mcp.xstep;
  20.       mcp._y -= mcp.ystep;
  21.    }
  22.    else
  23.    {
  24.       mcp._x -= mcp.xstep;
  25.       mcp._y -= mcp.ystep;
  26.    }
  27.    if(mcp.throwrock == true && 0 < mcp._y - mcp._height && (_level0.dweeb._x < mcp._x + mcp._width / 2 && mcp._x - mcp._width / 2 < _level0.dweeb._x))
  28.    {
  29.       _level0.attachMovie("rock","rock" + _level0.itemdepth,_level0.itemdepth);
  30.       _level0["rock" + _level0.itemdepth]._x = mcp._x;
  31.       _level0["rock" + _level0.itemdepth]._y = mcp._y;
  32.       _level0["rock" + _level0.itemdepth].parent = mcp;
  33.       _level0.itemdepth = _level0.itemdepth + 1;
  34.       mcp.throwcount = 12;
  35.       mcp.throwrock = false;
  36.    }
  37.    else if(mcp.throwrock == false)
  38.    {
  39.       mcp.throwcount--;
  40.       if(0 >= mcp.throwcount)
  41.       {
  42.          mcp.throwrock = true;
  43.       }
  44.    }
  45.    if(_level0.maxy < mcp._y)
  46.    {
  47.       for(i in "_level0:itemSet")
  48.       {
  49.          if(mcp == _level0.itemSet[i])
  50.          {
  51.             mcp.index = i;
  52.          }
  53.       }
  54.       _level0.itemSet.splice(mcp.index,1);
  55.       mcp.removeMovieClip();
  56.    }
  57. }
  58.