# Burger game health bar

**URL:** <https://forum.kirupa.com/t/burger-game-health-bar/322466>\
**Category:** Uncategorized\
**Created:** [May 22, 2011, 9:28am UTC](https://forum.kirupa.com/t/burger-game-health-bar/322466 "2011-05-22T09:28:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sirtumtum](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@sirtumtum](https://forum.kirupa.com/u/sirtumtum)\
**Post date:** [May 22, 2011, 9:28am UTC](https://forum.kirupa.com/t/burger-game-health-bar/322466/1 "2011-05-22T09:28:12Z")

</div>

hey guys,

just working on this,completely new to actionscript, been making this over a couple of days with a few snippets from my uni tutor. im just wondering if anyone can tell and help me how to finish my healthbar?

i need the tomato and bacon to have its own way of adding or subtracting health from the health bar. im stuck now, and i really dont have the experience yet to work around it. if anyone could help i would greatly appreciate it

this is what i got so far

bun.addEventListener(MouseEvent.MOUSE\_DOWN, mouseDownHandler);  
bun.addEventListener(MouseEvent.MOUSE\_UP, mouseUpHandler);

bacon.addEventListener(MouseEvent.MOUSE\_DOWN, mouseDownHandler);  
bacon.addEventListener(MouseEvent.MOUSE\_UP, mouseUpHandler);

tomato.addEventListener(MouseEvent.MOUSE\_DOWN, mouseDownHandler);  
tomato.addEventListener(MouseEvent.MOUSE\_UP, mouseUpHandler);

function mouseDownHandler(evt:MouseEvent):void {  
var object = evt.target;  
object.startDrag();  
}  
var health:int = 0;  
var healthBar = new HealthBar();  
stage.addChild(healthBar);  
healthBar.x = 200; //Set x position  
healthBar.y = 60; //set y position  
function mouseUpHandler(evt:MouseEvent):void {  
var object = evt.target;

```
var target = object.dropTarget;

object.stopDrag();

if (target != null && target.parent == bun) {
	health += 20; 
	healthBar.scaleX = health / 100;
	stop();}
	
}

//
 
//if (target != null && target.parent == bun) {
 //health += object.myPoints;
// healthBar.scaleX = health / 100;
// stop();}

```

//}
