Skip to content

Commit f3f9762

Browse files
committed
Add shouldBop in HealthIconData to allow any type of icon to bop.
1 parent 458bca3 commit f3f9762

3 files changed

Lines changed: 27 additions & 1 deletion

File tree

source/funkin/data/character/CharacterData.hx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ class CharacterDataParser
460460
public static final DEFAULT_NAME:String = 'Untitled Character';
461461
public static final DEFAULT_OFFSETS:Array<Float> = [0, 0];
462462
public static final DEFAULT_HEALTHICON_OFFSETS:Array<Int> = [0, 25];
463+
public static final DEFAULT_SHOULDBOP:Bool = true;
463464
public static final DEFAULT_RENDERTYPE:CharacterRenderType = CharacterRenderType.Sparrow;
464465
public static final DEFAULT_SCALE:Float = 1;
465466
public static final DEFAULT_SCROLL:Array<Float> = [0, 0];
@@ -532,6 +533,7 @@ class CharacterDataParser
532533
{
533534
input.healthIcon = {
534535
id: null,
536+
shouldBop: null,
535537
scale: null,
536538
flipX: null,
537539
isPixel: null,
@@ -544,6 +546,11 @@ class CharacterDataParser
544546
input.healthIcon.id = id;
545547
}
546548

549+
if (input.healthIcon.shouldBop == null)
550+
{
551+
input.healthIcon.shouldBop = DEFAULT_SHOULDBOP;
552+
}
553+
547554
if (input.healthIcon.scale == null)
548555
{
549556
input.healthIcon.scale = DEFAULT_SCALE;
@@ -833,6 +840,12 @@ typedef HealthIconData =
833840
*/
834841
var id:Null<String>;
835842

843+
/**
844+
* Whether the health icon should bop or not.
845+
* @default true
846+
*/
847+
var shouldBop:Null<Bool>;
848+
836849
/**
837850
* The scale of the health icon.
838851
*/

source/funkin/play/components/HealthIcon.hx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ class HealthIcon extends FunkinSprite
8080
*/
8181
var isLegacyStyle:Bool = false;
8282

83+
/**
84+
* Whether this icon should bop or not.
85+
*/
86+
var shouldBop:Bool = true;
87+
8388
/**
8489
* At this amount of health, play the Winning animation instead of the idle.
8590
*/
@@ -199,6 +204,7 @@ class HealthIcon extends FunkinSprite
199204
{
200205
this.characterId = data.id;
201206
this.isPixel = data.isPixel ?? false;
207+
this.shouldBop = data.shouldBop ?? true;
202208

203209
loadCharacter(characterId);
204210

@@ -294,7 +300,7 @@ class HealthIcon extends FunkinSprite
294300
public function onStepHit(curStep:Int):Void
295301
{
296302
// Make the icons bop.
297-
if (bopEvery != 0 && curStep % bopEvery == 0 && isLegacyStyle)
303+
if (bopEvery != 0 && curStep % bopEvery == 0 && shouldBop)
298304
{
299305
bopTween?.cancel();
300306
setGraphicSize(Std.int(this.width + (HEALTH_ICON_SIZE * this.size.x * BOP_SCALE)), 0);

source/funkin/play/event/SetHealthIconSongEvent.hx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class SetHealthIconSongEvent extends SongEvent
3838
static final DEFAULT_SCALE:Float = 1.0;
3939
static final DEFAULT_FLIPX:Bool = false;
4040
static final DEFAULT_ISPIXEL:Bool = false;
41+
static final DEFAULT_SHOULDBOP:Bool = true;
4142

4243
static final DEFAULT_X_OFFSET:Float = 0.0;
4344
static final DEFAULT_Y_OFFSET:Float = 0.0;
@@ -54,6 +55,7 @@ class SetHealthIconSongEvent extends SongEvent
5455

5556
var healthIconData:HealthIconData = {
5657
id: data.value.id ?? Constants.DEFAULT_HEALTH_ICON,
58+
shouldBop: data.value.shouldBop ?? DEFAULT_SHOULDBOP,
5759
scale: data.value.scale ?? DEFAULT_SCALE,
5860
flipX: data.value.flipX ?? DEFAULT_FLIPX,
5961
isPixel: data.value.isPixel ?? DEFAULT_ISPIXEL,
@@ -97,6 +99,11 @@ class SetHealthIconSongEvent extends SongEvent
9799
title: 'Health Icon ID',
98100
defaultValue: Constants.DEFAULT_HEALTH_ICON,
99101
type: SongEventFieldType.STRING,
102+
}, {
103+
name: 'shouldBop',
104+
title: 'Should Bop?',
105+
defaultValue: DEFAULT_SHOULDBOP,
106+
type: SongEventFieldType.BOOL,
100107
}, {
101108
name: 'scale',
102109
title: 'Scale',

0 commit comments

Comments
 (0)