@@ -162,14 +162,18 @@ class HealthIcon extends FunkinSprite
162162
163163 animateAtlas = null ; // reset
164164 if (this .animated )
165- loadSprite (Paths .image (iconPath ));
165+ loadSprite (Paths .image (newIconPath ));
166166 else {
167167 var iconAsset : FlxGraphic = FlxG .bitmap .add (Paths .image (iconPath ));
168168 var assetW : Float = iconAsset .width ;
169169 var assetH : Float = iconAsset .height ;
170170
171- iconAmt = Math .floor (assetW / assetH );
171+ iconAmt = Math .round (assetW / assetH ); // Just in case the icon is in a weird aspect ratio
172172 iconSize = Math .floor (assetW / iconAmt );
173+ if (iconSize * iconAmt > assetW ) {
174+ iconSize = Math .floor (assetW / iconAmt );
175+ iconAmt = Math .floor (assetW / iconSize );
176+ }
173177
174178 loadGraphic (iconAsset , true , Std .int (Math .min (iconSize , assetW )), Std .int (Math .min (iconSize , assetH )));
175179
@@ -238,8 +242,20 @@ class HealthIcon extends FunkinSprite
238242
239243 var animName = node .get (" name" );
240244
241- if (node .exists (" offsetX" ) || node .exists (" offsetY" ))
242- addOffset (animName , Std .parseFloat (node .get (" offsetX" )).getDefault (0 ), Std .parseFloat (node .get (" offsetY" )).getDefault (0 ));
245+ var offsetX : Float = 0 ;
246+ var offsetY : Float = 0 ;
247+ if (node .exists (" offsetX" ))
248+ offsetX = Std .parseFloat (node .get (" offsetX" )).getDefault (0 );
249+ else if (node .exists (" offsetx" ))
250+ offsetX = Std .parseFloat (node .get (" offsetx" )).getDefault (0 );
251+
252+ if (node .exists (" offsetY" ))
253+ offsetY = Std .parseFloat (node .get (" offsetY" )).getDefault (0 );
254+ else if (node .exists (" offsety" ))
255+ offsetY = Std .parseFloat (node .get (" offsety" )).getDefault (0 );
256+
257+ addOffset (animName , offsetX , offsetY );
258+
243259 addAnim (animName , node .get (" anim" ), Std .parseInt (node .get (" fps" )).getDefault (24 ), node .get (" looped" ).getDefault (" true" ).toLowerCase () == " true" );
244260 if (animateAtlas == null && animation .exists (animName ))
245261 animation .getByName (animName ).flipX = isPlayer != iconIsPlayer ;
@@ -299,6 +315,8 @@ class HealthIcon extends FunkinSprite
299315 }
300316
301317 defaultScale = (xmlValid && xmlData .exists (" scale" )) ? Std .parseFloat (xmlData .get (" scale" )).getDefault (scale .x ) : scale .x ;
318+ scale .set (defaultScale , defaultScale );
319+ updateHitbox ();
302320 }
303321
304322 var normalizedNames = [" neutral" , " losing" , " winning" ];
0 commit comments