PDA

View Full Version : for the love of god!


watermelon
11-10-2001, 03:08 AM
ok im making a health bar for my game, at the moment its a dynamic text box displaying a value of between 100-0. 0 being game over. but what i want to do is have my health displayed physicaly as a bar. nowi know what i want to do is take the life variable and use to it to _x scale my bar, but i dont know how to take

life = 100;

and makes its vale he length of the bar.
many thansk

Billy T
11-10-2001, 04:00 AM
put this on your healthbar

onClipEvent (enterFrame) {
_root.healthbar._xscale = HealthVariable;
}

this will scale it from the center. Use a mask or a box the same colour as your background to cover up half of it so it looks like its scaling from one end

hope this helps

wenbri
11-10-2001, 05:51 PM
You could also make the health indicator bar a 100 fram MC. Make it as long as you want it at 100%, then keyframe at 100. Go back to frame 1 and use the resize to shrink it to a thin line (i.e. 1%). Then add a shape tween between frames 1 and 100. In your game then:

_root.healthbar.gotoAndStop(HealthVariable);

Billy T
11-11-2001, 05:57 AM
I cant get that to work.

Have you actually done it?

wenbri
11-13-2001, 12:56 AM
It's the same principle as making a status bar for a preloader...excuse me, I mean Swonker. I think there's a tutorial here for it. You can see how I've used it on our homepage at www.beachredmonds.com/steph.html