Files
FNF-i486-Engine/source/AttachedText.hx
2022-08-31 00:44:05 -03:00

36 lines
843 B
Haxe

package;
import flixel.FlxSprite;
import flixel.graphics.frames.FlxAtlasFrames;
class AttachedText extends Alphabet
{
public var offsetX:Float = 0;
public var offsetY:Float = 0;
public var sprTracker:FlxSprite;
public var copyVisible:Bool = true;
public var copyAlpha:Bool = false;
public function new(text:String = "", ?offsetX:Float = 0, ?offsetY:Float = 0, ?bold = false, ?scale:Float = 1) {
super(0, 0, text, bold);
this.scaleX = scale;
this.scaleY = scale;
this.isMenuItem = false;
this.offsetX = offsetX;
this.offsetY = offsetY;
}
override function update(elapsed:Float) {
if (sprTracker != null) {
setPosition(sprTracker.x + offsetX, sprTracker.y + offsetY);
if(copyVisible) {
visible = sprTracker.visible;
}
if(copyAlpha) {
alpha = sprTracker.alpha;
}
}
super.update(elapsed);
}
}