home *** CD-ROM | disk | FTP | other *** search
/ One Click 21 (Special) / OC021.iso / Juegos / miniscrapercaper / miniscrapercaper.swf / scripts / frame_3 / DoAction_11.as < prev    next >
Encoding:
Text File  |  2006-02-02  |  4.6 KB  |  153 lines

  1. moverLine = function()
  2. {
  3.    var _loc1_ = this;
  4.    _loc1_.actPos += _loc1_.v.pos;
  5.    if(_loc1_.actPos > 1)
  6.    {
  7.       if(_loc1_.moverPingPong)
  8.       {
  9.          _loc1_.actPos = 1;
  10.          _loc1_.v.pos = Math.abs(_loc1_.v.pos) * -1;
  11.       }
  12.       else
  13.       {
  14.          _loc1_.actPos = 0;
  15.       }
  16.    }
  17.    else if(_loc1_.actPos < 0)
  18.    {
  19.       if(_loc1_.moverPingPong)
  20.       {
  21.          _loc1_.actPos = 0;
  22.          _loc1_.v.pos = Math.abs(_loc1_.v.pos);
  23.       }
  24.       else
  25.       {
  26.          _loc1_.actPos = 1;
  27.       }
  28.    }
  29.    _loc1_.x = _loc1_.rootPos.x + _loc1_.actPos * _loc1_.moverDx;
  30.    _loc1_.y = _loc1_.rootPos.y + _loc1_.actPos * _loc1_.moverDy;
  31.    _loc1_.v.x = _loc1_.x - _loc1_._x;
  32.    _loc1_.v.y = _loc1_.y - _loc1_._y;
  33.    _loc1_._x = _loc1_.x;
  34.    _loc1_._y = _loc1_.y;
  35.    if(_loc1_.behaviour == "monster")
  36.    {
  37.       if(_loc1_.v.x > 0)
  38.       {
  39.          _loc1_.gfx.gfx._xscale = Math.abs(_loc1_.gfx.gfx._xscale);
  40.       }
  41.       else
  42.       {
  43.          _loc1_.gfx.gfx._xscale = Math.abs(_loc1_.gfx.gfx._xscale) * -1;
  44.       }
  45.    }
  46.    if(_loc1_.chain)
  47.    {
  48.       _loc1_.chain._height = _loc1_.chain.minHeight + _loc1_.actPos * _loc1_.moverDy;
  49.    }
  50. };
  51. moverLineInit = function(mc, engine)
  52. {
  53.    var _loc1_ = mc;
  54.    _loc1_.d = Math.vectorLength({x:int(_loc1_.moverDx),y:int(_loc1_.moverDy)});
  55.    _loc1_.v = {pos:Number(_loc1_.moverV) / _loc1_.d};
  56.    _loc1_.rootPos = Math.pos(_loc1_);
  57.    if(_loc1_.moverPingPong eq "")
  58.    {
  59.       _loc1_.moverPingPong = 1;
  60.    }
  61.    _loc1_.actPos = Number(_loc1_.moverStartPos);
  62.    if(_loc1_.moverChain ne "")
  63.    {
  64.       _loc1_.chain = _loc1_._parent[_loc1_.moverChain];
  65.       _loc1_.chain.minHeight = _loc1_.chain._height;
  66.    }
  67. };
  68. moverCircle = function()
  69. {
  70.    var _loc1_ = this;
  71.    _loc1_.actPos = (_loc1_.actPos + 1 + _loc1_.v.pos) % 1;
  72.    if(_loc1_.chain)
  73.    {
  74.       _loc1_.chain._rotation = _loc1_.actPos * 360;
  75.    }
  76.    _loc1_.x = _loc1_.rootPos.x + Math.cos(_loc1_.actPos * 2 * 3.141592653589793) * _loc1_.moverRadius;
  77.    _loc1_.y = _loc1_.rootPos.y + Math.sin(_loc1_.actPos * 2 * 3.141592653589793) * _loc1_.moverRadius;
  78.    _loc1_._x = _loc1_.x;
  79.    _loc1_._y = _loc1_.y;
  80. };
  81. moverCircleInit = function(mc, engine)
  82. {
  83.    var _loc1_ = mc;
  84.    _loc1_.v = {pos:Number(_loc1_.moverV) / (6.283185307179586 * int(_loc1_.moverRadius))};
  85.    _loc1_.rootPos = Math.pos(_loc1_);
  86.    _loc1_.actPos = Number(_loc1_.moverStartPos);
  87.    if(_loc1_.moverChain ne "")
  88.    {
  89.       _loc1_.chain = _loc1_._parent[_loc1_.moverChain];
  90.    }
  91. };
  92. moverSwing = function()
  93. {
  94.    var _loc1_ = this;
  95.    _loc1_.actPos = (_loc1_.actPos + 1 + _loc1_.v.pos) % 1;
  96.    var _loc2_ = 1.5707963267948966 + Math.sin(_loc1_.actPos * 2 * 3.141592653589793) * _loc1_.moverAngle;
  97.    _loc1_.chain = _loc1_._parent[_loc1_.moverChain];
  98.    if(_loc1_.chain)
  99.    {
  100.       _loc1_.chain._rotation = _loc2_ / 3.141592653589793 * 180;
  101.    }
  102.    _loc1_.x = _loc1_.rootPos.x + Math.cos(_loc2_) * _loc1_.moverRadius;
  103.    _loc1_.y = _loc1_.rootPos.y + Math.sin(_loc2_) * _loc1_.moverRadius;
  104.    _loc1_._x = _loc1_.x;
  105.    _loc1_._y = _loc1_.y;
  106. };
  107. moverSwingInit = function(mc, engine)
  108. {
  109.    var _loc1_ = mc;
  110.    _loc1_.v = {pos:Number(_loc1_.moverV) / (6.283185307179586 * int(_loc1_.moverRadius))};
  111.    _loc1_.moverAngle = _loc1_.moverDegrees / 360 * 3.141592653589793;
  112.    _loc1_.rootPos = Math.pos(_loc1_);
  113.    _loc1_.actPos = Number(_loc1_.moverStartPos);
  114.    if(_loc1_.moverChain ne "")
  115.    {
  116.       _loc1_.chain = _loc1_._parent[_loc1_.moverChain];
  117.       trace("chain: " + _loc1_.moverChain + " => " + _loc1_.chain);
  118.       for(var _loc2_ in _loc1_._parent)
  119.       {
  120.          trace("mc." + _loc2_);
  121.       }
  122.    }
  123. };
  124. moverElastic = function()
  125. {
  126.    var _loc1_ = this;
  127.    if(_loc1_.stepTokens)
  128.    {
  129.       _loc1_.stepTokens = 0;
  130.       _loc1_.y += Math.cos(_loc1_.moverAngle) * _loc1_.moverStepWeight;
  131.       _loc1_.x += Math.sin(_loc1_.moverAngle) * _loc1_.moverStepWeight;
  132.    }
  133.    _loc1_.y = _loc1_.rootPos.y * _loc1_.moverFlex + _loc1_.y * (1 - _loc1_.moverFlex);
  134.    _loc1_.x = _loc1_.rootPos.x * _loc1_.moverFlex + _loc1_.x * (1 - _loc1_.moverFlex);
  135.    _loc1_.v.x = _loc1_.x - _loc1_._x;
  136.    _loc1_.v.y = _loc1_.y - _loc1_._y;
  137.    _loc1_._x = _loc1_.x;
  138.    _loc1_._y = _loc1_.y;
  139. };
  140. moverElasticOnStep = function()
  141. {
  142.    this.stepTokens = 1;
  143. };
  144. moverElasticInit = function(mc, engine)
  145. {
  146.    var _loc1_ = mc;
  147.    _loc1_.v = {pos:Number(_loc1_.moverV) / _loc1_.d};
  148.    _loc1_.rootPos = Math.pos(_loc1_);
  149.    _loc1_.moverAngle = int(_loc1_.moverAngle) / 180 * 3.141592653589793;
  150.    _loc1_.actPos = Number(_loc1_.moverStartPos);
  151.    _loc1_.onStep = _root.moverElasticOnStep;
  152. };
  153.