From 60e0668e7438b82403cc0b3fddaa7e3e829d30b0 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 29 Apr 2022 00:22:42 -0400 Subject: [PATCH] icon fixes (week 4 + positions) --- source/funkin/play/HealthIcon.hx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/funkin/play/HealthIcon.hx b/source/funkin/play/HealthIcon.hx index 005a8e8a7..e72810d68 100644 --- a/source/funkin/play/HealthIcon.hx +++ b/source/funkin/play/HealthIcon.hx @@ -1,7 +1,7 @@ package funkin.play; -import flixel.math.FlxMath; import flixel.FlxSprite; +import flixel.math.FlxMath; import flixel.math.FlxPoint; import funkin.play.character.CharacterData.CharacterDataParser; import openfl.utils.Assets; @@ -95,6 +95,11 @@ class HealthIcon extends FlxSprite */ static final LEGACY_PIXEL_SIZE = 32; + /** + * shitty hardcoded value for a specific positioning!!! + */ + static final POSITION_OFFSET = 26; + public function new(char:String = 'bf', playerId:Int = 0) { super(0, 0); @@ -153,14 +158,15 @@ class HealthIcon extends FlxSprite updateHealthIcon(PlayState.instance.health); // Update the position to match the health bar. this.x = PlayState.instance.healthBar.x - + (PlayState.instance.healthBar.width * (FlxMath.remapToRange(PlayState.instance.healthBar.value, 0, 2, 100, 0) * 0.01)); + + (PlayState.instance.healthBar.width * (FlxMath.remapToRange(PlayState.instance.healthBar.value, 0, 2, 100, 0) * 0.01) + - POSITION_OFFSET); case 1: // Dad // Update the animation based on the current state. updateHealthIcon(MAXIMUM_HEALTH - PlayState.instance.health); // Update the position to match the health bar. this.x = PlayState.instance.healthBar.x + (PlayState.instance.healthBar.width * (FlxMath.remapToRange(PlayState.instance.healthBar.value, 0, 2, 100, 0) * 0.01)) - - (this.width); + - (this.width - POSITION_OFFSET); } // Lerp the health icon back to its normal size,