From 34dce7266a7c86f277286c4cf6dd8622b1708474 Mon Sep 17 00:00:00 2001 From: Yoshubs <37424048+Yoshubs@users.noreply.github.com> Date: Fri, 8 Oct 2021 18:49:36 -0400 Subject: [PATCH] iconfix pt 2 --- source/gameObjects/userInterface/ClassHUD.hx | 4 ++-- source/gameObjects/userInterface/HealthIcon.hx | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/source/gameObjects/userInterface/ClassHUD.hx b/source/gameObjects/userInterface/ClassHUD.hx index 16ef2ac63..3e46d004e 100644 --- a/source/gameObjects/userInterface/ClassHUD.hx +++ b/source/gameObjects/userInterface/ClassHUD.hx @@ -103,8 +103,8 @@ class ClassHUD extends FlxTypedGroup healthBar.percent = (PlayState.health * 50); var iconLerp = 0.5; - iconP1.setGraphicSize(Std.int(FlxMath.lerp(150, iconP1.width, iconLerp))); - iconP2.setGraphicSize(Std.int(FlxMath.lerp(150, iconP2.width, iconLerp))); + iconP1.setGraphicSize(Std.int(FlxMath.lerp(iconP1.initialWidth, iconP1.width, iconLerp))); + iconP2.setGraphicSize(Std.int(FlxMath.lerp(iconP1.initialWidth, iconP2.width, iconLerp))); iconP1.updateHitbox(); iconP2.updateHitbox(); diff --git a/source/gameObjects/userInterface/HealthIcon.hx b/source/gameObjects/userInterface/HealthIcon.hx index de99f0a2f..26f2e0490 100644 --- a/source/gameObjects/userInterface/HealthIcon.hx +++ b/source/gameObjects/userInterface/HealthIcon.hx @@ -11,6 +11,8 @@ class HealthIcon extends FlxSprite { // rewrite using da new icon system as ninjamuffin would say it public var sprTracker:FlxSprite; + public var initialWidth:Float = 0; + public var initialHeight:Float = 0; public function new(char:String = 'bf', isPlayer:Bool = false) { @@ -35,6 +37,10 @@ class HealthIcon extends FlxSprite antialiasing = true; var iconGraphic:FlxGraphic = FlxG.bitmap.add(Paths.image('icons/icon-' + iconPath)); loadGraphic(iconGraphic, true, Std.int(iconGraphic.width / 2), iconGraphic.height); + + initialWidth = width; + initialHeight = height; + animation.add('icon', [0, 1], 0, false, isPlayer); animation.play('icon'); scrollFactor.set();