Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 135144

Hit count and action

$
0
0

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);


Viewing all articles
Browse latest Browse all 135144

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>