Skip to content

Commit

Permalink
iconfix pt 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoshubs authored and Yoshubs committed Oct 8, 2021
1 parent a2c89d7 commit 34dce72
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/gameObjects/userInterface/ClassHUD.hx
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ class ClassHUD extends FlxTypedGroup<FlxBasic>
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();
Expand Down
6 changes: 6 additions & 0 deletions source/gameObjects/userInterface/HealthIcon.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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();
Expand Down

0 comments on commit 34dce72

Please sign in to comment.