I've been looking around the forum but couldn't find a easier method of adding hp bars in my game then the one it was on the old forum.All the credit goes to DespondentDonkey.
The code looks like this:
public class StatusBar extends Entity
public var bar:Image;
public var tick:Image;
public var ratio:Number;
public function StatusBar(barImage:Image, tickImage:Image, x:int = 0, y:int = 0, layer:int = -4)
bar = barImage;
super(x, y, bar);
tick = tickImage;
this.layer = layer;
override public function update():void
tick.clipRect.height = (ratio) * bar.height;
And in world class:
private var YourHpBar:StatusBar = new StatusBar( new Image(TheHpBarImage), new Image(TheLiquidImage), HpBarX, HpBarY, HpBarLayer);
And all you have to do is to change YourHpBar.ratio as u wish(should be between 0 and 1).
If you whant to play around with the bar ,to make the liquid drain from the top/bottom or to make a verticaly bar, just change YourHpBar.tick.scaleY or for the other case in the StatusBar update instead of height change it to width.
Hope this helps