From 7601ea7b1fb68f3576630f90935e4fa0d649c6f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=9EHoovy=E2=9C=9E?= <124418090+MemeHovy@users.noreply.github.com> Date: Wed, 25 Oct 2023 17:54:46 -0400 Subject: [PATCH] rewritten healthicons (#52) fixes the issues they had --- source/PlayState.hx | 52 ++++++++++++++------------------------------- 1 file changed, 16 insertions(+), 36 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index 0dc8ecf03b6..a7abf8c0dca 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -5324,44 +5324,24 @@ if (ClientPrefs.showNPS) { if (health > maxHealth) health = maxHealth; - if (iconP1.animation.frames == 3) { - if (healthBar.percent < 20) - (opponentChart ? iconP2 : iconP1).animation.curAnim.curFrame = 1; - else if (healthBar.percent > 80) - (opponentChart ? iconP2 : iconP1).animation.curAnim.curFrame = 2; - else - (opponentChart ? iconP2 : iconP1).animation.curAnim.curFrame = 0; - } else { - if (healthBar.percent < 20) - (opponentChart ? iconP2 : iconP1).animation.curAnim.curFrame = 1; - else - (opponentChart ? iconP2 : iconP1).animation.curAnim.curFrame = 0; + // this was giving me a headache rewriting this :D + var stupidIcons:Array = [iconP1, iconP2]; + if (opponentChart) stupidIcons = [iconP2, iconP1]; + + if (healthBar.percent < 20){ + stupidIcons[0].animation.curAnim.curFrame = 1; + if (stupidIcons[1].width == 450) + stupidIcons[1].animation.curAnim.curFrame = 2; } - if (iconP2.animation.frames == 3) { - if (healthBar.percent > 80) - (opponentChart ? iconP1 : iconP2).animation.curAnim.curFrame = 1; - else if (healthBar.percent < 20) - (opponentChart ? iconP1 : iconP2).animation.curAnim.curFrame = 2; - else - (opponentChart ? iconP1 : iconP2).animation.curAnim.curFrame = 0; - } else { - if (healthBar.percent > 80) - (opponentChart ? iconP1 : iconP2).animation.curAnim.curFrame = 1; - else - (opponentChart ? iconP1 : iconP2).animation.curAnim.curFrame = 0; + else if (healthBar.percent > 80){ + if (stupidIcons[0].width == 450) + stupidIcons[0].animation.curAnim.curFrame = 2; + stupidIcons[1].animation.curAnim.curFrame = 1; + } + else{ + stupidIcons[0].animation.curAnim.curFrame = 0; + stupidIcons[1].animation.curAnim.curFrame = 0; } - - /* - if (healthBar.percent < 20) - (opponentChart ? iconP2 : iconP1).animation.curAnim.curFrame = 1; - else - (opponentChart ? iconP2 : iconP1).animation.curAnim.curFrame = 0; - - if (healthBar.percent > 80) - (opponentChart ? iconP1 : iconP2).animation.curAnim.curFrame = 1; - else - (opponentChart ? iconP1 : iconP2).animation.curAnim.curFrame = 0; - */ if (FlxG.keys.anyJustPressed(debugKeysCharacter) && !endingSong && !inCutscene && !softlocked) { persistentUpdate = false;