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.
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;
}
}
}