Hi. I’m trying to make an xp bar, which updates its own scale depending on Hero.xp
package assets.xp_bar { import net.flashpunk.FP; import net.flashpunk.Entity; import net.flashpunk.Graphic; import flash.geom.Rectangle; import net.flashpunk.graphics.Image;
public class XpBar extends Image
{
[Embed(source="../XpBar.png")] private const XP:Class;
public function XpBar(XP, clipRect:flash.geom.Rectangle=null)
{
super(source, clipRect);
x = 460;
y = 980;
layer = 1;
graphic = new Image(XP);
}
override public function update():void
{
x = 460 + FP.world.camera.x;
this.scaleX = Hero.xp;
}
}
}
But I get errors no matter what I try to do. Should this be an entity? An image? I don’t get it.
If I make it into an entity, there is no “.scaleX”. God damn it!