home *** CD-ROM | disk | FTP | other *** search
- movieclip.prototype.bulletlaunch = function(tipe, bulletrange)
- {
- if(tipe <= 2)
- {
- m.attachmovie("sbul1","e" + r.ed,r.ed);
- m["e" + r.ed].delay = bulletrange;
- m["e" + r.ed]._x = this._x;
- if(tipe == 2)
- {
- m["e" + r.ed]._yscale = -100;
- m["e" + r.ed]._y = this._y - 40;
- }
- else
- {
- m["e" + r.ed]._y = this._y + 40;
- }
- }
- else if(tipe > 2 and tipe < 5)
- {
- m.attachmovie("sbul2","e" + r.ed,r.ed);
- m["e" + r.ed].delay = bulletrange;
- m["e" + r.ed]._y = this._y;
- if(tipe == 3)
- {
- m["e" + r.ed]._xscale = -100;
- m["e" + r.ed]._x = this._x + 35;
- }
- else
- {
- m["e" + r.ed]._x = this._x - 35;
- }
- }
- else if(tipe > 4 and tipe < 7)
- {
- m.attachmovie("sbul2","e" + r.ed,r.ed);
- m["e" + r.ed].delay = 100;
- m["e" + r.ed]._y = this._y - 44;
- if(tipe == 5)
- {
- m["e" + r.ed]._xscale = -100;
- m["e" + r.ed]._x = this._x + 40;
- }
- else
- {
- m["e" + r.ed]._x = this._x - 40;
- }
- }
- r.ed = r.ed + 1;
- };
- movieclip.prototype.cekhitp = function(it)
- {
- if(p.z.hittest(it))
- {
- r.hit = 1;
- if(p._x - this._x < 0)
- {
- r.hitdir = 1;
- }
- else
- {
- r.hitdir = 2;
- }
- return true;
- }
- return false;
- };
- movieclip.prototype.cekhitattack = function(it)
- {
- if(p.z.hittest(it))
- {
- if(r.pnow == 2 and r.jump and math.abs(r.xs) > 3)
- {
- this.die = 1;
- return false;
- }
- if(p._x - this._x < 0)
- {
- r.hitdir = 1;
- }
- else
- {
- r.hitdir = 2;
- }
- r.hit = 1;
- return true;
- }
- return false;
- };
- movieclip.prototype.cekboxcoll = function(ex, ey, ew, eh, sx, sy, sw, sh)
- {
- var res = 0;
- if(math.abs(ex - sx) < ew + sw)
- {
- if(ey - sy >= 0 and ey - sy <= eh or sy - ey >= 0 and sy - ey <= sh)
- {
- res = 1;
- }
- }
- return res;
- };
- Movieclip.prototype.initb = function()
- {
- if(!this.tipe)
- {
- var tipe = 0;
- }
- else
- {
- var tipe = this.tipe;
- }
- var wi = this.z._width * 0.01 * this._xscale;
- var hi = this.z._height * 0.01 * this._yscale;
- if(tipe == 2)
- {
- if(this.xs > 0)
- {
- var xmi = this._x;
- var xma = this._x + math.abs(this.xrange);
- }
- else if(this.xs < 0)
- {
- var xmi = this._x - math.abs(this.xrange);
- var xma = this._x;
- }
- if(this.ys > 0)
- {
- var ymi = this._y;
- var yma = this._y + math.abs(this.yrange);
- }
- else if(this.ys < 0)
- {
- trasce(fsd);
- var ymi = this._y - math.abs(this.yrange);
- var yma = this._y;
- }
- c.push({n:this._name,t:tipe,w:wi,h:hi,x1:this._x,y1:this._y,x2:this._x + wi,y2:this._y + hi,xc:this._x + 0.5 * wi,xs:this.xs,ys:this.ys,xmin:xmi,xmax:xma,ymin:ymi,ymax:yma});
- }
- else
- {
- b.push({n:this._name,t:tipe,w:wi,h:hi,x1:this._x,y1:this._y,x2:this._x + wi,y2:this._y + hi,xc:this._x + 0.5 * wi});
- }
- };
- 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++;
- }
- };
- 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();
- }
- };
- }
- };
- 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});
- };
-