# Shrinking a healthbar

**URL:** <https://forum.kirupa.com/t/shrinking-a-healthbar/291283>\
**Category:** Uncategorized\
**Created:** [June 27, 2009, 7:20am UTC](https://forum.kirupa.com/t/shrinking-a-healthbar/291283 "2009-06-27T07:20:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SonOfChaos](https://avatars.discourse-cdn.com/v4/letter/s/7c8e57/32.png) [@SonOfChaos](https://forum.kirupa.com/u/SonOfChaos)\
**Post date:** [June 27, 2009, 7:20am UTC](https://forum.kirupa.com/t/shrinking-a-healthbar/291283/1 "2009-06-27T07:20:49Z")

</div>

Okay, I’ve got a healthbar that shrinks everytime a character is hit when an object becomes larger than a certain size. This is in an enter\_frame, basically the healthbar shrinks every frame, when I want it to shrink ONCE and then stop until hit again. I used a boolean value set to false to control it so I thought. Argh.

```auto

collisionOne is a boolean that = false;

//This is in an enterframe event.
for(var e=0; e<boxArray.length; e++){
if(boxArray[e].scaleX > 2){
                            
                            boxArray[e].die();
                            if(! collisionOne){
                                trace('collision One');
                                hbar.width -=5;
                                collisionOne = true;
                            } else {
                                collisionOne = false;
                            }
                        }
                        
                
                }

```
