# Health bar

**URL:** <https://forum.kirupa.com/t/health-bar/68370>\
**Category:** flash\
**Created:** [October 25, 2004, 12:46pm UTC](https://forum.kirupa.com/t/health-bar/68370 "2004-10-25T12:46:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![binime](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@binime](https://forum.kirupa.com/u/binime)\
**Post date:** [October 25, 2004, 12:46pm UTC](https://forum.kirupa.com/t/health-bar/68370/1 "2004-10-25T12:46:13Z")

</div>

hey! i have started to make a game, nothing to complicated. so far i am using two squares just to test it out. i have two dynamic text boxes, one for health and one for score. i also have a little bar which width is equal to the \_root.health part. my code

```auto
 
_root.health = 100;
_root.score = 0;
if (_root.health<=0) {
 gotoAndStop(2);
}
stop();

```

this code is on the first frame off my game. on one of my squares i have the following code (its just to test for the health and score btw)

```auto
 
onClipEvent (enterFrame) {
 if (Key.isDown(Key.DOWN)) {
  this._y += 5;
 } else if (Key.isDown(Key.RIGHT)) {
  this._x += 5;
 }
 if (this.hitTest(_root.box)) {
  _root.box.removeMovieClip();
  _root.score += 1000;
  _root.health -= 30;
  stop();
 }
}

```

now i have made another frame so that my intention is if the health is less than or equal to 0 it will go to it, but it doesnt. can somebody please help me or point me in the right direction? any help would be much appreciated  
~binime
