Frame 1
stop();
Frame 2
function InitNiveau() {
var _local1 = _root;
clipLimites = _local1.fond.getBounds(_local1);
((Math.round(Math.random()) == 1) ? ((posX = 0)) : ((posX = clipLimites.xMax)));
posY = Math.round(Math.random() * clipLimites.yMax);
index = _local1.pisteOvnis[0];
while (index <= ((_local1.pisteOvnis[0] + (_local1.Niveau * 2)) - 1)) {
duplicateMovieClip ("_root.ovnis", "ovnis" + index, index);
setProperty("_root.ovnis" + index, _x , posX);
setProperty("_root.ovnis" + index, _y , posY);
index++;
}
duplicateMovieClip ("_root.vaisseau", "vaisseau" + _local1.pisteVaisseau, _local1.pisteVaisseau);
}
function TermNiveau() {
var _local1 = _root;
index = _local1.pisteOvnis[0];
while (index <= _local1.pisteOvnis[1]) {
removeMovieClip("ovnis" + index);
index++;
}
}
function TrouverpisteOvnis() {
index = _root.pisteOvnis[0];
while (index <= _root.pisteOvnis[1]) {
if (eval (("ovnis" + index) + "._x") == undefined) {
return(index);
}
index++;
}
return(undefined);
}
function VerifierFinNiveau() {
if (eval (("_root.vaisseau" + _root.pisteVaisseau) + "._x") == undefined) {
if (_root.Vies == 0) {
_root.TermNiveau();
_root.gotoAndPlay(2);
} else {
duplicateMovieClip ("_root.vaisseau", "vaisseau" + _root.pisteVaisseau, _root.pisteVaisseau);
}
}
index = _root.pisteOvnis[0];
while (index <= _root.pisteOvnis[1]) {
if (eval (("ovnis" + index) + "._x") != undefined) {
return(true);
}
index++;
}
_root.Niveau = _root.Niveau + 1;
_root.InitNiveau();
return(false);
}
function DupliqueMeteore(clip) {
var _local1 = clip;
var _local2 = _root;
if (_local1._xscale > 50) {
tween = 1;
while (tween <= 2) {
piste = _local2.TrouverpisteOvnis();
duplicateMovieClip (_local2.ovnis, "ovnis" + piste, piste);
setProperty("_root.ovnis" + piste, _xscale , _local1._xscale - 25);
setProperty("_root.ovnis" + piste, _yscale , _local1._yscale - 25);
setProperty("_root.ovnis" + piste, _x , _local1._x);
setProperty("_root.ovnis" + piste, _y , _local1._y);
tween++;
}
}
_local2.VerifierFinNiveau();
}
function genereBonus() {
if (Math.round(Math.random()) == 1) {
duplicateMovieClip (_root.bonusvitesse, "bonusvitesse1", 2000);
} else {
duplicateMovieClip (_root.bonusbouclier, "bonusbouclier1", 2000);
}
}
_root.pisteVaisseau = 1;
_root.pisteProjectile = new Array(2, 6);
_root.pisteOvnis = new Array(7, 100);
_root.pisteBonusBouclier = 101;
_root.Vies = 3;
_root.Pointage = 0;
_root.Niveau = 1;
_root.vaisseau1.propulseur._visible = false;
bonus = setInterval(genereBonus, 30000);
_root.InitNiveau();
stop();
Instance of Symbol 34 MovieClip "vaisseau" in Frame 2
onClipEvent (load) {
if (this.getDepth() == _root.pisteVaisseau) {
this.clipLimites = _root.fond.getBounds(_root);
this._x = this.clipLimites.xMax / 2;
this._y = this.clipLimites.yMax / 2;
this._rotation = 0;
this.trajectoireX = 0;
this.trajectoireY = 0;
this.vitesse = 2;
temps = new Date();
this.tempsGrace = temps.getTime() + 3000;
this._alpha = 25;
this.propulseur._visible = false;
}
}
onClipEvent (enterFrame) {
if (this.getDepth() == _root.pisteVaisseau) {
posX = this._x;
posY = this._y;
switch (true) {
case (posX + this.trajectoireX) < this.clipLimites.xMin :
posX = this.clipLimites.xMax;
break;
case (posX + this.trajectoireX) > this.clipLimites.xMax :
posX = this.clipLimites.xMin;
break;
case (posY + this.trajectoireY) < this.clipLimites.yMin :
posY = this.clipLimites.yMax;
break;
case (posY + this.trajectoireY) > this.clipLimites.yMax :
posY = this.clipLimites.yMin;
break;
default :
posX = posX + this.trajectoireX;
posY = posY + this.trajectoireY;
}
this._x = posX;
this._y = posY;
temps = new Date();
if (this.tempsGrace < temps.getTime()) {
this._alpha = 100;
index = _root.pisteOvnis[0];
while (index < _root.pisteOvnis[1]) {
if (eval (("_root.ovnis" + index) + "._x") != undefined) {
posX = eval (("_root.ovnis" + index) + "._x");
posY = eval (("_root.ovnis" + index) + "._y");
if (this.hitTest(posX, posY, true)) {
_root.Vies = _root.Vies - 1;
removeMovieClip(this);
_root.DupliqueMeteore(eval ("_root.ovnis" + index));
}
}
index++;
}
}
}
}
Instance of Symbol 37 MovieClip in Frame 2
onClipEvent (load) {
temps = new Date();
this.delaiTir = temps.getTime() + 300;
}
onClipEvent (enterFrame) {
if (Key.isDown(38)) {
if (_root.vaisseau1.vitesse < 10) {
_root.vaisseau1.vitesse = _root.vaisseau1.vitesse + 0.5;
}
_root.vaisseau1.propulseur._visible = true;
} else {
_root.vaisseau1.propulseur._visible = false;
}
if (Key.isDown(40)) {
if (_root.vaisseau1.vitesse > 0) {
_root.vaisseau1.vitesse = _root.vaisseau1.vitesse - 0.5;
}
}
if (Key.isDown(37)) {
_root.vaisseau1._rotation = _root.vaisseau1._rotation - 10;
}
if (Key.isDown(39)) {
_root.vaisseau1._rotation = _root.vaisseau1._rotation + 10;
}
if (Key.isDown(32)) {
temps = new Date();
if (this.delaiTir < temps.getTime()) {
this.delaiTir = temps.getTime() + 500;
index = _root.pisteProjectile[0];
while (index <= _root.pisteProjectile[1]) {
if (eval (("_root.projectile" + index) + "._x") == undefined) {
duplicateMovieClip (_root.projectile, "projectile" + index, index);
son_tirer = new Sound();
son_tirer.attachSound("Tire");
son_tirer.start();
break;
}
index++;
}
}
}
angle = ((Math.PI*2) * _root.vaisseau1._rotation) / 360;
_root.vaisseau1.trajectoireX = Math.cos(angle) * _root.vaisseau1.vitesse;
_root.vaisseau1.trajectoireY = Math.sin(angle) * _root.vaisseau1.vitesse;
}
Instance of Symbol 44 MovieClip "ovnis" in Frame 2
onClipEvent (load) {
if ((this.getDepth() >= _root.pisteOvnis[0]) && (this.getDepth() <= _root.pisteOvnis[1])) {
this.clipLimites = _root.fond.getBounds(_root);
((Math.round(Math.random()) == 1) ? ((this.trajectoireX = Math.round(Math.random() * 5))) : ((this.trajectoireX = -Math.round(Math.random() * 5))));
((Math.round(Math.random()) == 1) ? ((this.trajectoireY = Math.round(Math.random() * 5))) : ((this.trajectoireY = -Math.round(Math.random() * 5))));
((Math.round(Math.random()) == 1) ? ((this.vitesseRotation = Math.round(Math.random() * 10))) : ((this.vitesseRotation = -Math.round(Math.random() * 10))));
}
}
onClipEvent (enterFrame) {
if ((this.getDepth() >= _root.pisteOvnis[0]) && (this.getDepth() <= _root.pisteOvnis[1])) {
posX = this._x;
posY = this._y;
switch (true) {
case (posX + this.trajectoireX) < this.clipLimites.xMin :
posX = this.clipLimites.xMax;
break;
case (posX + this.trajectoireX) > this.clipLimites.xMax :
posX = this.clipLimites.xMin;
break;
case (posY + this.trajectoireY) < this.clipLimites.yMin :
posY = this.clipLimites.yMax;
break;
case (posY + this.trajectoireY) > this.clipLimites.yMax :
posY = this.clipLimites.yMin;
break;
default :
posX = posX + this.trajectoireX;
posY = posY + this.trajectoireY;
}
this._x = posX;
this._y = posY;
this._rotation = this._rotation + this.vitesseRotation;
}
index = _root.pisteProjectile[0];
while (index < _root.pisteProjectile[1]) {
if (eval (("_root.projectile" + index) + "._x") != undefined) {
posX = eval (("_root.projectile" + index) + "._x");
posY = eval (("_root.projectile" + index) + "._y");
if (this.hitTest(eval ("_root.projectile" + index))) {
removeMovieClip(eval ("_root.projectile" + index));
_root.Pointage = _root.Pointage + 100;
if ((((((_root.Pointage == 5000) || (_root.Pointage == 10000)) || (_root.Pointage == 15000)) || (_root.Pointage == 20000)) || (_root.Pointage == 25000)) || (_root.Pointage == 30000)) {
_root.Vies = _root.Vies + 1;
}
this.gotoAndplay(2);
explosion = new Sound();
explosion.attachSound("Explosion Ovni");
explosion.start();
}
}
index++;
}
}
Instance of Symbol 52 MovieClip "projectile" in Frame 2
onClipEvent (load) {
if ((this.getDepth() >= _root.pisteProjectile[0]) && (this.getDepth() <= _root.pisteProjectile[1])) {
this.clipLimites = _root.fond.getBounds(_root);
this._x = _root.vaisseau1._x;
this._y = _root.vaisseau1._y;
this._rotation = _root.vaisseau1._rotation;
this._trajectoireX = 0;
this._trajectoireY = 0;
this.vitesse = 50;
this.angleRadian = ((Math.PI*2) * _root.vaisseau1._rotation) / 360;
}
}
onClipEvent (enterFrame) {
if ((this.getDepth() >= _root.pisteProjectile[0]) && (this.getDepth() <= _root.pisteProjectile[1])) {
deltaX = Math.cos(this.angleRadian) * this.vitesse;
deltaY = Math.sin(this.angleRadian) * this.vitesse;
this._x = this._x + deltaX;
this._y = this._y + deltaY;
if ((((this._x < this.clipLimites.xMin) || (this._x > this.clipLimites.xMax)) || (this._y < this.clipLimites.yMin)) || (this._y > this.clipLimites.yMax)) {
removeMovieClip(this);
}
}
}
Instance of Symbol 57 MovieClip "bonusbouclier" in Frame 2
onClipEvent (load) {
if (this.getDepth() == 2000) {
this._x = Math.round(Math.random() * _root.clipLimites.xMax);
this._y = _root.clipLimites.yMax;
}
}
onClipEvent (enterFrame) {
if (this.getDepth() == 2000) {
this._x = this._x + 2;
this._y = this._y - 4;
if ((((this._x < this._root.clipLimites.xMin) || (this._x > this._root.clipLimites.xMax)) || (this._y < this._root.clipLimites.yMin)) || (this._y > this._root.clipLimites.yMax)) {
removeMovieClip(this);
}
if (this.hitTest(_root.vaisseau1)) {
_root.vaisseau1._alpha = 25;
temps = new Date();
_root.vaisseau1.tempsGrace = temps.getTime() + 10000;
removeMovieClip(this);
}
}
}
Instance of Symbol 61 MovieClip "bonusvitesse" in Frame 2
onClipEvent (load) {
if (this.getDepth() == 2000) {
this._x = Math.round(Math.random() * _root.clipLimites.xMax);
this._y = _root.clipLimites.yMin;
}
}
onClipEvent (enterFrame) {
if (this.getDepth() == 2000) {
this._x = this._x - 2;
this._y = this._y + 4;
if ((((this._x < this._root.clipLimites.xMin) || (this._x > this._root.clipLimites.xMax)) || (this._y < this._root.clipLimites.yMin)) || (this._y > this._root.clipLimites.yMax)) {
removeMovieClip(this);
}
if (this.hitTest(_root.vaisseau1)) {
removeMovieClip(this);
_root.vaisseau1.vitesse = 20;
}
}
}
Frame 3
stop();
removeMovieClip(vaisseau1);
_root.TermNiveau();
Symbol 14 Button
on (release) {
gotoAndStop (2);
}
Symbol 19 Button
on (release) {
gotoAndStop (4);
}
Symbol 44 MovieClip Frame 1
stop();
Symbol 44 MovieClip Frame 2
Symbol 44 MovieClip Frame 7
removeMovieClip(clip);
_root.DupliqueMeteore(this);
Symbol 71 Button
on (release) {
gotoAndStop (2);
}
Symbol 77 Button
on (release) {
nextFrame();
}
Symbol 82 Button
on (release) {
gotoAndStop (1);
}