# Healthbar --\> next frame

**URL:** <https://forum.kirupa.com/t/healthbar-next-frame/189140>\
**Category:** Uncategorized\
**Created:** [May 14, 2006, 5:44am UTC](https://forum.kirupa.com/t/healthbar-next-frame/189140 "2006-05-14T05:44:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![darksauce](https://avatars.discourse-cdn.com/v4/letter/d/f05b48/32.png) [@darksauce](https://forum.kirupa.com/u/darksauce)\
**Post date:** [May 14, 2006, 5:44am UTC](https://forum.kirupa.com/t/healthbar-next-frame/189140/1 "2006-05-14T05:44:18Z")

</div>

hi, i need help with my game and i need help asap. i have a health bar that wen some1 gets hit, it loses 1 health block by fading its alpha to 30. i want it so dat when the last block goes, it plays the next frame, but my code isnt working. plz help! my code:

\_root.health1 = 50;  
if (this.hitTest(this.target)) {  
\_root.health1 -= 10;  
trace(“You hit the target”);  
this.removeMovieClip();  
}

and there are 5 health movieclips, one with \<50, \<40, \<30, \<20, and \<10 code is:

onClipEvent (enterFrame) {  
if(\_root.health1\<50)  
{  
this.\_alpha=30;  
}  
else{this.\_alpha=100;  
}  
}

and the final bit is :

if (\_root.health1 == 0 or \_root.health1\<0) {  
nextFrame();  
}

plz helps asap!!!
