home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Acao / Titans / star.swf / scripts / frame_5 / DoAction.as
Encoding:
Text File  |  2006-01-05  |  3.8 KB  |  172 lines

  1. movieclip.prototype.cekhit = function(name)
  2. {
  3.    if(!name)
  4.    {
  5.       var it = this;
  6.    }
  7.    else
  8.    {
  9.       var it = this[name];
  10.    }
  11.    var i = 0;
  12.    while(i < r.bul.length)
  13.    {
  14.       var b = r[r.bul[i]];
  15.       if(b._x < 590)
  16.       {
  17.          if(it.hittest(b))
  18.          {
  19.             if(!b.tipe)
  20.             {
  21.                this.hit = 1;
  22.                r.bul.removevalue(r.bul[i]);
  23.                b.removeMovieClip();
  24.             }
  25.             else
  26.             {
  27.                this.hit = 3;
  28.             }
  29.             if(this.group != 0)
  30.             {
  31.                r[this.group + "got"]++;
  32.                if(r[this.group + "total"] == r[this.group + "got"])
  33.                {
  34.                   r.skorbonus = r[this.group + "total"] * 3 * r.point;
  35.                   r.score += r.skorbonus;
  36.                   r.attachmovie("popskor","popskor" + r.psd,r.psd);
  37.                   r["popskor" + r.psd]._x = this._x - 40;
  38.                   r["popskor" + r.psd]._y = this._y;
  39.                   r.psd = r.psd + 1;
  40.                }
  41.             }
  42.             break;
  43.          }
  44.       }
  45.       i++;
  46.    }
  47. };
  48. movieclip.prototype.initme = function()
  49. {
  50.    if(this._name.substr(0,3) == "ins")
  51.    {
  52.       var group = 0;
  53.    }
  54.    else
  55.    {
  56.       var group = "gr" + this._name;
  57.       r["gr" + this._name + "total"]++;
  58.       r["gr" + this._name + "got"] = 0;
  59.    }
  60.    r.allgroups.push("gr" + this._name + "total");
  61.    r.enemy.push({name:this.name,group:group,x:this._x,y:this._y});
  62. };
  63. Movieclip.prototype.findang = function(dx, dy)
  64. {
  65.    return deg(math.atan2(dy,dx));
  66. };
  67. Movieclip.prototype.rad = function(qdeg)
  68. {
  69.    return qdeg * 0.017453292519943295;
  70. };
  71. Movieclip.prototype.deg = function(qrad)
  72. {
  73.    return qrad * 57.29577951308232;
  74. };
  75. Array.prototype.numsortOn = function(p)
  76. {
  77.    Array.$sortprop = p;
  78.    var sortfunc = function(a, b)
  79.    {
  80.       var p = Array.$sortprop;
  81.       return b[p] < a[p];
  82.    };
  83.    this.sort(sortfunc);
  84.    delete Array.$sortprop;
  85. };
  86. Array.prototype.copy = Array.prototype.slice;
  87. Array.prototype.randomize = function()
  88. {
  89.    return this.sort(function(a, b)
  90.    {
  91.       return Math.floor(Math.random() * 2) != 0 ? -1 : 1;
  92.    }
  93.    );
  94. };
  95. Array.prototype.removeElement = function(i)
  96. {
  97.    if(i == null)
  98.    {
  99.       i = 0;
  100.    }
  101.    var r = this[i];
  102.    var j = i;
  103.    while(j < this.length - 1)
  104.    {
  105.       this[j] = this[j + 1];
  106.       j++;
  107.    }
  108.    this.pop();
  109.    return r;
  110. };
  111. Array.prototype.removeValue = function(a)
  112. {
  113.    var i = 0;
  114.    while(i < this.length)
  115.    {
  116.       if(a == this[i])
  117.       {
  118.          this.removeElement(i);
  119.       }
  120.       i++;
  121.    }
  122. };
  123. Color.prototype.setBrightness = function(value)
  124. {
  125.    this.setTransform({ra:100,rb:0,ga:100,gb:0,ba:100,bb:0});
  126.    var trans = this.getTransform();
  127.    var percent = Math.abs(value) / 100;
  128.    var brightnessColor = value <= 0 ? 0 : 255;
  129.    with(trans)
  130.    {
  131.       ra -= ra * percent;
  132.       ga -= ga * percent;
  133.       ba -= ba * percent;
  134.       rb += (brightnessColor - rb) * percent;
  135.       gb += (brightnessColor - gb) * percent;
  136.       bb += (brightnessColor - bb) * percent;
  137.    }
  138.    this.setTransform(trans);
  139. };
  140. Color.prototype.resetcolor = function()
  141. {
  142.    this.setTransform({ra:100,rb:0,ga:100,gb:0,ba:100,bb:0});
  143. };
  144. Movieclip.prototype.fadescreen = function(speed)
  145. {
  146.    if(!speed)
  147.    {
  148.       var speed = 5;
  149.    }
  150.    _root.createemptymovieclip("dark",100001);
  151.    var d = _root.dark;
  152.    with(d)
  153.    {
  154.       lineStyle(1,0,100);
  155.       beginfill(0,100);
  156.       moveto(-5000,-5000);
  157.       lineto(5000,-5000);
  158.       lineto(5000,5000);
  159.       lineto(-5000,5000);
  160.       endfill();
  161.       d.onEnterFrame = function()
  162.       {
  163.          _alpha -= speed;
  164.          if(_alpha <= 0)
  165.          {
  166.             removeMovieClip("");
  167.             stop();
  168.          }
  169.       };
  170.    }
  171. };
  172.