home *** CD-ROM | disk | FTP | other *** search
- movieclip.prototype.cekhit = function(name)
- {
- if(!name)
- {
- var it = this;
- }
- else
- {
- var it = this[name];
- }
- var i = 0;
- while(i < r.bul.length)
- {
- var b = r[r.bul[i]];
- if(b._x < 590)
- {
- if(it.hittest(b))
- {
- if(!b.tipe)
- {
- this.hit = 1;
- r.bul.removevalue(r.bul[i]);
- b.removeMovieClip();
- }
- else
- {
- this.hit = 3;
- }
- if(this.group != 0)
- {
- r[this.group + "got"]++;
- if(r[this.group + "total"] == r[this.group + "got"])
- {
- r.skorbonus = r[this.group + "total"] * 3 * r.point;
- r.score += r.skorbonus;
- r.attachmovie("popskor","popskor" + r.psd,r.psd);
- r["popskor" + r.psd]._x = this._x - 40;
- r["popskor" + r.psd]._y = this._y;
- r.psd = r.psd + 1;
- }
- }
- break;
- }
- }
- i++;
- }
- };
- movieclip.prototype.initme = function()
- {
- if(this._name.substr(0,3) == "ins")
- {
- var group = 0;
- }
- else
- {
- var group = "gr" + this._name;
- r["gr" + this._name + "total"]++;
- r["gr" + this._name + "got"] = 0;
- }
- r.allgroups.push("gr" + this._name + "total");
- r.enemy.push({name:this.name,group:group,x:this._x,y:this._y});
- };
- Movieclip.prototype.findang = function(dx, dy)
- {
- return deg(math.atan2(dy,dx));
- };
- Movieclip.prototype.rad = function(qdeg)
- {
- return qdeg * 0.017453292519943295;
- };
- Movieclip.prototype.deg = function(qrad)
- {
- return qrad * 57.29577951308232;
- };
- Array.prototype.numsortOn = function(p)
- {
- Array.$sortprop = p;
- var sortfunc = function(a, b)
- {
- var p = Array.$sortprop;
- return b[p] < a[p];
- };
- this.sort(sortfunc);
- delete Array.$sortprop;
- };
- Array.prototype.copy = Array.prototype.slice;
- Array.prototype.randomize = function()
- {
- return this.sort(function(a, b)
- {
- return Math.floor(Math.random() * 2) != 0 ? -1 : 1;
- }
- );
- };
- Array.prototype.removeElement = function(i)
- {
- if(i == null)
- {
- i = 0;
- }
- var r = this[i];
- var j = i;
- while(j < this.length - 1)
- {
- this[j] = this[j + 1];
- j++;
- }
- this.pop();
- return r;
- };
- Array.prototype.removeValue = function(a)
- {
- var i = 0;
- while(i < this.length)
- {
- if(a == this[i])
- {
- this.removeElement(i);
- }
- i++;
- }
- };
- Color.prototype.setBrightness = function(value)
- {
- this.setTransform({ra:100,rb:0,ga:100,gb:0,ba:100,bb:0});
- var trans = this.getTransform();
- var percent = Math.abs(value) / 100;
- var brightnessColor = value <= 0 ? 0 : 255;
- with(trans)
- {
- ra -= ra * percent;
- ga -= ga * percent;
- ba -= ba * percent;
- rb += (brightnessColor - rb) * percent;
- gb += (brightnessColor - gb) * percent;
- bb += (brightnessColor - bb) * percent;
- }
- this.setTransform(trans);
- };
- Color.prototype.resetcolor = function()
- {
- this.setTransform({ra:100,rb:0,ga:100,gb:0,ba:100,bb:0});
- };
- Movieclip.prototype.fadescreen = function(speed)
- {
- if(!speed)
- {
- var speed = 5;
- }
- _root.createemptymovieclip("dark",100001);
- var d = _root.dark;
- with(d)
- {
- lineStyle(1,0,100);
- beginfill(0,100);
- moveto(-5000,-5000);
- lineto(5000,-5000);
- lineto(5000,5000);
- lineto(-5000,5000);
- endfill();
- d.onEnterFrame = function()
- {
- _alpha -= speed;
- if(_alpha <= 0)
- {
- removeMovieClip("");
- stop();
- }
- };
- }
- };
-