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();}
//}