home *** CD-ROM | disk | FTP | other *** search
- movieclip.prototype.findlane = function()
- {
- if(!r.laneposran.length)
- {
- r.laneposran = r.lanepos.copy();
- r.laneposran.randomize();
- }
- var popped = r.laneposran.pop();
- if(popped == r.lastpop)
- {
- var popped = r.laneposran.pop();
- }
- r.lastpop = popped;
- return popped;
- };
- movieclip.prototype.cekswapdep = function()
- {
- if(!r.jump and this._x < 300)
- {
- if(this._y < s._y and this.dep > s.dep or this._y > s._y and this.dep < s.dep)
- {
- this.swapdepths(s);
- var dumm = this.dep;
- this.dep = s.dep;
- s.dep = dumm;
- }
- }
- };
- movieclip.prototype.cekswapdepenemy = function()
- {
- var i = 1;
- while(i < r.enemy.length)
- {
- if(_name != r.enemy[i])
- {
- var e = r[r.enemy[i]];
- if(this._y < e._y and this.dep > e.dep or this._y > e._y and this.dep < e.dep)
- {
- this.swapdepths(e);
- var dumm = this.dep;
- this.dep = e.dep;
- e.dep = dumm;
- }
- }
- i++;
- }
- };
- movieclip.prototype.ceklimits = function()
- {
- if(this.nx < r.xmin)
- {
- this.nx = r.xmin;
- }
- if(this.nx > r.xmax)
- {
- this.nx = r.xmax;
- }
- if(this.ny < r.ymin)
- {
- this.ny = r.ymin;
- }
- if(this.ny > r.ymax)
- {
- this.ny = r.ymax;
- }
- };
- movieclip.prototype.cekbulletenemy = function()
- {
- var i = 0;
- while(i < r.bul.length)
- {
- var b = r[r.bul[i]];
- if(this.z.hittest(b))
- {
- this.hit = 1;
- var n = 100 + random(999999);
- this.attachmovie("sparke","s" + n,n);
- this["s" + n]._x = b._x - this._x;
- this["s" + n]._y = b._y - this._y;
- r.bul.removevalue(r.bul[i]);
- b.removeMovieClip();
- r.score += r.point;
- this.energy--;
- if(this.energy <= 0)
- {
- r.zboom2.start();
- this.gotoAndPlay("exp");
- }
- else
- {
- this.attachmovie("blink2","blink2",99);
- }
- break;
- }
- i++;
- }
- };
- movieclip.prototype.cekbulletenemy2 = function()
- {
- var i = 0;
- while(i < r.bul.length)
- {
- var b = r[r.bul[i]];
- if(this.z.hittest(b._x,b._y,1))
- {
- this.hit = 1;
- var n = 100 + random(999999);
- this.attachmovie("sparke","s" + n,n);
- this["s" + n]._x = b._x - this._x;
- this["s" + n]._y = b._y - this._y;
- r.bul.removevalue(r.bul[i]);
- b.removeMovieClip();
- r.score += r.point;
- this.energy--;
- if(this.energy <= 0)
- {
- r.zboom2.start();
- this.gotoAndPlay("exp");
- }
- else
- {
- this.attachmovie("blink2","blink2",99);
- }
- break;
- }
- i++;
- }
- };
- movieclip.prototype.cekbulletcar = function()
- {
- if(s._x < this._x)
- {
- var i = 0;
- while(i < r.bul.length)
- {
- var b = r[r.bul[i]];
- if(this.c.z.hittest(b._x,b._y,1))
- {
- this.hit = 1;
- var n = 100 + random(999999);
- this.attachmovie("spark","s" + n,n);
- if(this.tipe > 1 and this.tipe <= 6)
- {
- this["s" + n]._x = random(10);
- this["s" + n]._y = b._y - this._y;
- }
- else
- {
- this["s" + n]._x = b._x - this._x;
- this["s" + n]._y = b._y - this._y;
- }
- r.bul.removevalue(r.bul[i]);
- b.removeMovieClip();
- break;
- }
- i++;
- }
- }
- };
- movieclip.prototype.cekhite = function()
- {
- if(this.z2.hittest(s.z2))
- {
- r.hit = 1;
- return true;
- }
- return false;
- };
- movieclip.prototype.cekhitr = function()
- {
- if(s._y < this._y and s._y > this._y - this.hei)
- {
- if(r.sx2 > this._x and r.sx1 < this._x + this.wid)
- {
- return true;
- }
- return false;
- }
- return false;
- };
- movieclip.prototype.initme = function()
- {
- r.enemy.push({name:this.name,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",1000001);
- 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();
- }
- };
- }
- };
-