home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Acao / Titans / raven.swf / scripts / frame_4 / DoAction.as
Encoding:
Text File  |  2006-01-05  |  4.4 KB  |  198 lines

  1. movieclip.prototype.makecrash = function(tipe1, tipe2, total)
  2. {
  3.    var i = 0;
  4.    while(i < total)
  5.    {
  6.       r.attachmovie("crashing","rub" + r.rd,r.rd);
  7.       var rbb = r["rub" + r.rd];
  8.       rbb._xscale = 60 + random(100);
  9.       rbb._yscale = 60 + random(40);
  10.       if(random(100) > 70)
  11.       {
  12.          rbb._yscale = 120 + random(80);
  13.       }
  14.       rbb._x = this._x - 40 + random(80);
  15.       rbb._y = this._y - 40 + random(80);
  16.       rbb.vx = 0.2 * this.vx;
  17.       rbb.vy = 0.2 * this.vy;
  18.       if(random(100) > 50)
  19.       {
  20.          rbb.tipe = tipe1;
  21.       }
  22.       else
  23.       {
  24.          rbb.tipe = tipe2;
  25.       }
  26.       r.rd = r.rd + 1;
  27.       i++;
  28.    }
  29. };
  30. movieclip.prototype.makecrash_instruction = function(tipe1, tipe2, total)
  31. {
  32.    var i = 0;
  33.    while(i < total)
  34.    {
  35.       this.attachmovie("crashing","rub" + r.rd,r.rd);
  36.       var ska = 60 + random(40);
  37.       var rbb = this["rub" + r.rd];
  38.       rbb._xscale = ska;
  39.       rbb._yscale = ska;
  40.       rbb._x = -40 + random(80);
  41.       rbb._y = -40 + random(80);
  42.       rbb.vx = 0.2 * this.vx;
  43.       rbb.vy = 0.2 * this.vy;
  44.       if(random(100) > 50)
  45.       {
  46.          rbb.tipe = tipe1;
  47.       }
  48.       else
  49.       {
  50.          rbb.tipe = tipe2;
  51.       }
  52.       r.rd = r.rd + 1;
  53.       i++;
  54.    }
  55. };
  56. movieclip.prototype.followmouse = function()
  57. {
  58.    var nx = r._xmouse;
  59.    var ny = r._ymouse;
  60.    if(nx < 50)
  61.    {
  62.       nx = 50;
  63.    }
  64.    else if(nx > 550)
  65.    {
  66.       nx = 550;
  67.    }
  68.    var oldx = this._x;
  69.    var oldy = this._y;
  70.    this._x = nx + (this._x - nx) / 1.4;
  71.    this._y = ny + (this._y - ny) / 1.4;
  72.    r.vx = this._x - oldx;
  73.    r.vy = this._y - oldy;
  74. };
  75. movieclip.prototype.letgo = function()
  76. {
  77.    if(r.water._visible)
  78.    {
  79.       r.attachmovie("waterdrop","rub" + r.rd2,r.rd2);
  80.       r["rub" + r.rd2]._x = r.water._x;
  81.       r["rub" + r.rd2]._y = r.water._y;
  82.       r.rubs.push("rub" + r.rd2);
  83.       r.rd2--;
  84.       r.water.removeMovieClip();
  85.    }
  86.    else if(r.rub2._visible)
  87.    {
  88.       r.attachmovie("rub","rub" + r.rd,r.rd);
  89.       r["rub" + r.rd].tipe = r.got;
  90.       r["rub" + r.rd].ys = 6;
  91.       r["rub" + r.rd]._x = r.rub2._x;
  92.       r["rub" + r.rd]._y = r.rub2._y;
  93.       r["rub" + r.rd]._rotation = r.rub2._rotation;
  94.       r.rubs.push("rub" + r.rd);
  95.       r.rd = r.rd + 1;
  96.       r.rub2.removeMovieClip();
  97.    }
  98.    r.got = 0;
  99. };
  100. Movieclip.prototype.findang = function(dx, dy)
  101. {
  102.    return deg(math.atan2(dy,dx));
  103. };
  104. Movieclip.prototype.rad = function(qdeg)
  105. {
  106.    return qdeg * 0.017453292519943295;
  107. };
  108. Movieclip.prototype.deg = function(qrad)
  109. {
  110.    return qrad * 57.29577951308232;
  111. };
  112. Array.prototype.copy = Array.prototype.slice;
  113. Array.prototype.randomize = function()
  114. {
  115.    return this.sort(function(a, b)
  116.    {
  117.       return Math.floor(Math.random() * 2) != 0 ? -1 : 1;
  118.    }
  119.    );
  120. };
  121. Array.prototype.removeElement = function(i)
  122. {
  123.    if(i == null)
  124.    {
  125.       i = 0;
  126.    }
  127.    var r = this[i];
  128.    var j = i;
  129.    while(j < this.length - 1)
  130.    {
  131.       this[j] = this[j + 1];
  132.       j++;
  133.    }
  134.    this.pop();
  135.    return r;
  136. };
  137. Array.prototype.removeValue = function(a)
  138. {
  139.    var i = 0;
  140.    while(i < this.length)
  141.    {
  142.       if(a == this[i])
  143.       {
  144.          this.removeElement(i);
  145.       }
  146.       i++;
  147.    }
  148. };
  149. Movieclip.prototype.fadescreen = function(speed)
  150. {
  151.    if(!speed)
  152.    {
  153.       var speed = 5;
  154.    }
  155.    _root.createemptymovieclip("dark",100001);
  156.    var d = _root.dark;
  157.    with(d)
  158.    {
  159.       lineStyle(1,0,100);
  160.       beginfill(0,100);
  161.       moveto(-5000,-5000);
  162.       lineto(5000,-5000);
  163.       lineto(5000,5000);
  164.       lineto(-5000,5000);
  165.       endfill();
  166.       d.onEnterFrame = function()
  167.       {
  168.          _alpha -= speed;
  169.          if(_alpha <= 0)
  170.          {
  171.             removeMovieClip("");
  172.             stop();
  173.          }
  174.       };
  175.    }
  176. };
  177. Color.prototype.setBrightness = function(value)
  178. {
  179.    this.setTransform({ra:100,rb:0,ga:100,gb:0,ba:100,bb:0});
  180.    var trans = this.getTransform();
  181.    var percent = Math.abs(value) / 100;
  182.    var brightnessColor = value <= 0 ? 0 : 255;
  183.    with(trans)
  184.    {
  185.       ra -= ra * percent;
  186.       ga -= ga * percent;
  187.       ba -= ba * percent;
  188.       rb += (brightnessColor - rb) * percent;
  189.       gb += (brightnessColor - gb) * percent;
  190.       bb += (brightnessColor - bb) * percent;
  191.    }
  192.    this.setTransform(trans);
  193. };
  194. Color.prototype.resetcolor = function()
  195. {
  196.    this.setTransform({ra:100,rb:0,ga:100,gb:0,ba:100,bb:0});
  197. };
  198.