diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 463650f8..c8337deb 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -294,6 +294,11 @@ class PlayState extends MusicBeatState * Opponent's icon */ public var iconP2:HealthIcon; + /** + * Every active icon that will be updated during gameplay (defaults to `iconP1` and `iconP1` between `create` and `postCreate` in scripts) + */ + public var iconArray:Array = []; + /** * Camera for the HUD (notes, misses). */ @@ -750,9 +755,9 @@ class PlayState extends MusicBeatState health = maxHealth / 2; - iconP1 = new HealthIcon(boyfriend != null ? boyfriend.getIcon() : "face", true); - iconP2 = new HealthIcon(dad != null ? dad.getIcon() : "face", false); - for(icon in [iconP1, iconP2]) { + iconArray.push(iconP1 = new HealthIcon(boyfriend != null ? boyfriend.getIcon() : "face", true)); + iconArray.push(iconP2 = new HealthIcon(dad != null ? dad.getIcon() : "face", false)); + for (icon in iconArray) { icon.y = healthBar.y - (icon.height / 2); add(icon); } @@ -769,7 +774,8 @@ class PlayState extends MusicBeatState scoreTxt.alignment = RIGHT; missesTxt.alignment = CENTER; accuracyTxt.alignment = LEFT; - updateRatingStuff(); + if (updateRatingStuff != null) + updateRatingStuff(); for(e in [healthBar, healthBarBG, iconP1, iconP2, scoreTxt, missesTxt, accuracyTxt]) e.cameras = [camHUD]; @@ -1227,7 +1233,7 @@ class PlayState extends MusicBeatState iconP2.health = 1 - (healthBarPercent / 100); } - function updateRatingStuff() { + dynamic function updateRatingStuff() { scoreTxt.text = 'Score:$songScore'; missesTxt.text = '${comboBreaks ? "Combo Breaks" : "Misses"}:$misses'; @@ -1257,7 +1263,8 @@ class PlayState extends MusicBeatState return; } - updateRatingStuff(); + if (updateRatingStuff != null) + updateRatingStuff(); if (canAccessDebugMenus) { if (chartingMode && FlxG.keys.justPressed.SEVEN) { @@ -1271,7 +1278,7 @@ class PlayState extends MusicBeatState } if (doIconBop) - for (icon in [iconP1, iconP2]) + for (icon in iconArray) if (icon.updateBump != null) icon.updateBump(); @@ -1849,7 +1856,7 @@ class PlayState extends MusicBeatState } if (doIconBop) - for (icon in [iconP1, iconP2]) + for (icon in iconArray) if (icon.bump != null) icon.bump();