Voilà une grosse partie du code que j´ai mis sur la premiere image.
J´ai mis un removeMovieClip sur les autres séquences pour faire disparaitre les ennemis mais ils continuent à tirer. Si quelqu´un voit comment les arrêter...
var fire = false;
var bouclier = 100;
var vie = 3;
var score = 0;
var touche = false;
function moveHero(speed) {
if ( Key.isDown(Key.UP)) {
_root.faucon._y -= speed;
/*if ( faucon._y<0) {
faucon._y = 0;
}*/
} else if ( key.isDown(key.DOWN)) {
_root.faucon._y += speed;
if ( faucon._y>=550) {
faucon._y = 550;
}
}
if ( key.isDown(key.RIGHT)) {
_root.faucon._x += speed;
if ( faucon._x>=500) {
faucon._x = 500;
}
} else if ( key.isDown(key.LEFT)) {
_root.faucon._x -= speed;
if ( faucon._x<=0) {
faucon._x = 0;
}
}
if ( key.isDown(key.SPACE)) {
if ( fire == false) {
tireMissile();
}
}
}
_root.onEnterFrame = function() {
moveHero(10);
if ( vie<0) {
gotoAndPlay("gameover", 1);
}
};
var i;
function tireMissile() {
i++;
if ( i == 10) {
i = 0;
}
fire = true;
_root.faucon.gotoAndPlay(2);
var newname = " missilet"+i;
_root.attachMovie("missilet", newname, i*100);
_root[newname]._y = _root.faucon._y-30;
_root[newname]._x = _root.faucon._x+0;
_root[newname].onEnterFrame = function() {
var missile_speed = 20;
this._y -= missile_speed;
if ( this._y<0) {
this.removeMovieClip();
}
for ( var h = 0; h<=numEnemy; h++) {
if ( this.hitTest(_root["tie"+h])) {
this.removeMovieClip();
_root["tie"+h].play();
score = ( score+1);
}
}
}
};
}
var numEnemy = 3;
var numEnemyi = 1;
var numEnemya = 0;
function Enemys() {
for ( j=1; j<=numEnemy; j++) {
var name = " tie"+j;
_root.tie0.duplicateMovieClip(name, j);
}
}
function check_dead() {
if ( _root.touche == false) {
for ( z=1; z<_root.numEnemy; z++) {
if ( _root.faucon.hitTest(_root["tie"+z])) {
_root.touche = true;
_root.bouclier = ( _root.bouclier-3);
if ( _root.bouclier<=0) {
_root.vie--;
_root.faucon.gotoAndPlay("heroboom");
_root.bouclier = 100;
if ( vie<0) {
gotoAndPlay("gameover", 1);
}
}
}
}
Enemys();
var w = 1;
function enemyMissile(tie) {
w++;
//name bullets
var newname = " missileEn"+w;
_root.attachMovie("enemyMissilet", newname, w*400);
_root[newname]._y = tie._y+31;
_root[newname]._x = tie._x+0;
_root[newname].onEnterFrame = function() {
var missile_speed = 20;
this._y += missile_speed;
if ( this._y>560) {
this.removeMovieClip();
}
if ( this.hitTest(_root.faucon)) {
this.removeMovieClip();
_root.bouclier = ( _root.bouclier-1);
this.removeMovieClip;
if ( _root.bouclier<=0) {
_root.vie--;
_root.faucon.gotoAndPlay("heroboom");
_root.bouclier = 100;
if ( vie<0) {
gotoAndPlay("gameover", 1);
}
}
}
};
}