home *** CD-ROM | disk | FTP | other *** search
- Boss1 = function()
- {
- super();
- this._x = 800;
- this._y = 200;
- this.vie = 5000;
- this.tombe = false;
- this.trajectoire = "cercle";
- this.vitesse = 5;
- this.savex = this._x;
- this.savey = this._y;
- this.rayonx = 0;
- this.rayony = 20;
- this.attachMovie("LifeBossBarClip","lifeBossBar",1);
- this.lifeBossBar.init(-100,130,100,10,"0xFF0000","0xFFFFFF");
- };
- Boss1.prototype = new Ennemi();
- Object.registerClass("Boss1ClipHaut",Boss1);
- Boss1.prototype.onEnterFrame = function()
- {
- if(this._x == 400 && !this.bossStop)
- {
- this.bossStop = this.bossStop + 1;
- this.vitesse = 0;
- }
- if(this.vie > 0)
- {
- this.move();
- this.tirnormal();
- this.testTirVaisseau();
- this.clignote();
- }
- else
- {
- this.explose();
- this._parent.score += 500;
- if(this.tombe)
- {
- this._x += -5;
- this._rotation -= 0.2;
- this._y += 1;
- if(this._x < -250)
- {
- this.removeMovieClip();
- }
- }
- }
- };
- Boss1.prototype.testTirVaisseau = function(bool)
- {
- var j = 0;
- while(j < _global.tabTirVaisseau.length)
- {
- var i = _global.tabTirVaisseau[j];
- clip = this._parent.tirVaisseauClip["tirVaisseau" + i];
- if(clip._currentframe < 3)
- {
- if(this.hitTest(clip._x,clip._y,true))
- {
- this.vie -= clip.degats;
- clip.vitesse = 0;
- this._parent.score += 500;
- this.touche = true;
- clip.play();
- }
- }
- j++;
- }
- };
- Boss1.prototype.explose = function()
- {
- this._alpha = 100;
- this.numExp = this.numExp + 1;
- this.attachMovie("ExplosionClip","explosion" + this.numExp,this.numExp);
- clip = this["explosion" + this.numExp];
- clip._x = random(250) * Math.cos(Math.random() * 3.141592653589793 * 2);
- clip._y = random(150) * Math.sin(Math.random() * 3.141592653589793 * 2);
- clip._xscale = random(100) + 50;
- clip._yscale = clip._xscale;
- clip._rotation = random(500);
- if(this.numExp > 40)
- {
- this.savey = this._y;
- this.tombe = true;
- }
- };
- Boss1.prototype.tirnormal = function()
- {
- if(random(5) == 0)
- {
- var r = random(6);
- if(r < 4)
- {
- i = this.chercheTirLibre();
- if(i == -1)
- {
- return 0;
- }
- this._parent.tirEnnemiClip.attachMovie("TirDirigeClip","tirEnnemi" + i,_global.tirEnnemiDepth + i);
- var clip = this._parent.tirEnnemiClip["tirEnnemi" + i];
- if(r == 0)
- {
- clip._x = this._x - 170;
- clip._y = this._y + 50;
- }
- else if(r == 1)
- {
- clip._x = this._x + 100;
- clip._y = this._y - 90;
- }
- else if(r == 2)
- {
- clip._x = this._x - 95;
- clip._y = this._y + 40;
- }
- else if(r == 3)
- {
- clip._x = this._x + 40;
- clip._y = this._y - 50;
- }
- clip.angle = Math.atan2(this._parent.vesso._y - clip._y,this._parent.vesso._x - clip._x);
- clip.vitesse = 15;
- }
- else
- {
- var angle = Math.atan2(this._parent.vesso._y - this._y,this._parent.vesso._x - this._x);
- var j = 0;
- while(j < 3)
- {
- i = this.chercheTirLibre();
- if(i == -1)
- {
- return 0;
- }
- this._parent.tirEnnemiClip.attachMovie("TirDirigeClip","tirEnnemi" + i,_global.tirEnnemiDepth + i);
- var clip = this._parent.tirEnnemiClip["tirEnnemi" + i];
- if(r == 4)
- {
- if(j == 0)
- {
- clip._x = this._x - 25;
- clip._y = this._y + 10;
- }
- if(j == 1)
- {
- clip._x = this._x - 25;
- clip._y = this._y + 25;
- }
- if(j == 2)
- {
- clip._x = this._x - 25;
- clip._y = this._y + 40;
- }
- }
- else if(r == 5)
- {
- if(j == 0)
- {
- clip._x = this._x + 55;
- clip._y = this._y + 5;
- }
- if(j == 1)
- {
- clip._x = this._x + 70;
- clip._y = this._y - 5;
- }
- if(j == 2)
- {
- clip._x = this._x + 85;
- clip._y = this._y - 10;
- }
- }
- clip.angle = angle;
- clip.vitesse = 15;
- j++;
- }
- }
- }
- };
-