Hey guys, I have done tons of health or experience bars in some example games and projects but they have always been done horizontally… What I am currently trying to achieve is an experience bar that will sit on the left corner of the screen and as the player gains experience I would like it to move upwards.
This is how I typically handle a health bar, I think I need to do something like this but in reverse and portrait not landscape style:
package entities
{
import net.flashpunk.Entity;
import net.flashpunk.FP;
import net.flashpunk.graphics.Image;
import entities.*
public class HealthBar extends Entity
{
public var bar:Image = Image.createRect(200, 32, 0xFF0000);
public function HealthBar()
{
super(0, 0, bar);
bar.clipRect.width = 200;
(bar as Image).alpha = 0.7;
layer = 0;
}
override public function update():void
{
bar.clipRect.width = thePlayer.health;
bar.clear();
bar.updateBuffer();
bar.x = FP.camera.x;
bar.y = FP.camera.y;
}
}
}
Thanks for any input guys!