# Health Bar

**URL:** <https://forum.kirupa.com/t/health-bar/1080>\
**Category:** flash\
**Created:** [August 8, 2002, 1:55am UTC](https://forum.kirupa.com/t/health-bar/1080 "2002-08-08T01:55:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wes321](https://avatars.discourse-cdn.com/v4/letter/w/96bed5/32.png) [@wes321](https://forum.kirupa.com/u/wes321)\
**Post date:** [August 8, 2002, 1:55am UTC](https://forum.kirupa.com/t/health-bar/1080/1 "2002-08-08T01:55:38Z")

</div>

Im making a game where there is a ufo and you have to watch out for balls that come at you. I have a health bar that every time you get hit it goes down a little bit. How can i make it so when the ufo collides into a ball it takes a little bit away from the health bar. How can i do this? and what is the scripting if its requires scripting

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 9, 2002, 6:12am UTC](https://forum.kirupa.com/t/health-bar/1080/2 "2002-08-09T06:12:16Z")

</div>

If your health bar were a movie clip and had an instance name of healthA1bar, and was on the main timeline, then you could use this.

first frame of the main timeline

healthA1=100;  
function takeahit(){  
healthA1-=10;  
\_root.healthA1bar.\_yscale=healthA1;  
}

now that’s really simple mind you.

are you going to have more than one alien on the screen at once?

are you creating the alien using an attachMovie(); or duplicateMovie() method?

I think, if you want code, you’re going to have to explain a lot more of what it is that you have already, and what it is you’re trying to accomplish with it.
