When I hit the target for the first time, it goes to the ending scene. How do I be in the same scene until I hit the target twice and on the third time to go to the end scene?
var life = 3;
attkrButton.addEventListener (MouseEvent.CLICK, attacker01);
function lifeEnemy(evt:Event): void {
if(this.colliderPlayer.hitTestObject(boss)){
life = life - 1;
if(life==0) {
stage.removeEventListener(Event.ENTER_FRAME, lifeEnemy);
MovieClip(root).gotoAndStop('ending');
}
}
function attacker01 (e:MouseEvent): void {
colliderPlayer.gotoAndPlay(2);
}
stage.addEventListener(Event.ENTER_FRAME, lifeEnemy);