Skip to content

Commit b895815

Browse files
committed
Added 'no ghost sprite' option to Mini Hearts
1 parent 0e278de commit b895815

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Ahorn/entities/miniHeart.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
using ..Ahorn, Maple
44

5-
@mapdef Entity "CollabUtils2/MiniHeart" MiniHeart(x::Integer, y::Integer, sprite::String="beginner", refillDash::Bool=true, requireDashToBreak::Bool=true)
6-
@mapdef Entity "CollabUtils2/FakeMiniHeart" FakeMiniHeart(x::Integer, y::Integer, sprite::String="beginner", refillDash::Bool=true, requireDashToBreak::Bool=true)
5+
@mapdef Entity "CollabUtils2/MiniHeart" MiniHeart(x::Integer, y::Integer, sprite::String="beginner", refillDash::Bool=true, requireDashToBreak::Bool=true, noGhostSprite::Bool=false)
6+
@mapdef Entity "CollabUtils2/FakeMiniHeart" FakeMiniHeart(x::Integer, y::Integer, sprite::String="beginner", refillDash::Bool=true, requireDashToBreak::Bool=true, noGhostSprite::Bool=false)
77

88
heartUnion = Union{MiniHeart, FakeMiniHeart}
99

Ahorn/lang/en_gb.lang

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ placements.triggers.CollabUtils2/JournalTrigger.tooltips.showOnlyDiscovered=If c
1111
placements.entities.CollabUtils2/MiniHeart.tooltips.sprite=The sprite the mini heart should use.
1212
placements.entities.CollabUtils2/MiniHeart.tooltips.refillDash=Whether bouncing on the heart should refill dashes.
1313
placements.entities.CollabUtils2/MiniHeart.tooltips.requireDashToBreak=Whether the player needs to dash on the heart to collect it.\nIf this is unchecked, the player will be able to collect the heart by just touching it.
14+
placements.entities.CollabUtils2/MiniHeart.tooltips.noGhostSprite=If checked, the heart will never use the "ghost" sprite even when already collected.
1415

1516
# Fake Mini Heart
1617
placements.entities.CollabUtils2/FakeMiniHeart.tooltips.sprite=The sprite the fake mini heart should use.
1718
placements.entities.CollabUtils2/FakeMiniHeart.tooltips.refillDash=Whether bouncing on the heart should refill dashes.
1819
placements.entities.CollabUtils2/FakeMiniHeart.tooltips.requireDashToBreak=Whether the player needs to dash on the heart to make it disappear.\nIf this is unchecked, the heart will disappear when the player touches it.
20+
placements.entities.CollabUtils2/FakeMiniHeart.tooltips.noGhostSprite=If checked, the heart will never use the "ghost" sprite even when already collected.
1921

2022
# Rainbow Berry
2123
placements.entities.CollabUtils2/RainbowBerry.tooltips.levelSet=The rainbow berry will only spawn if all silver berries in this level set have been collected.

Entities/AbstractMiniHeart.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public abstract class AbstractMiniHeart : Entity {
1010
private string spriteName;
1111
private bool refillDash;
1212
private bool requireDashToBreak;
13+
private bool noGhostSprite;
1314

1415
protected Wiggler scaleWiggler;
1516

@@ -30,6 +31,7 @@ public AbstractMiniHeart(EntityData data, Vector2 position, EntityID gid)
3031
spriteName = data.Attr("sprite");
3132
refillDash = data.Bool("refillDash", defaultValue: true);
3233
requireDashToBreak = data.Bool("requireDashToBreak", defaultValue: true);
34+
noGhostSprite = data.Bool("noGhostSprite", defaultValue: false);
3335

3436
Collider = new Hitbox(12f, 12f, -6f, -6f);
3537

@@ -51,7 +53,7 @@ public override void Awake(Scene scene) {
5153

5254
string spritePath = "CollabUtils2/miniheart/" + spriteName + "/";
5355
bool alreadyCollectedInSave = SaveData.Instance.Areas_Safe[area.ID].Modes[(int) area.Mode].HeartGem;
54-
if (alreadyCollectedInSave) {
56+
if (alreadyCollectedInSave && !noGhostSprite) {
5557
// use the ghost sprite specific to the heart: instead of reading 00.png, read ghost00.png
5658
spritePath += "ghost";
5759
if (!GFX.Game.Has(spritePath + "00")) {
@@ -101,7 +103,7 @@ public override void Awake(Scene scene) {
101103
};
102104
break;
103105
}
104-
if (alreadyCollectedInSave) {
106+
if (alreadyCollectedInSave && !noGhostSprite) {
105107
heartColor = Color.White * 0.8f;
106108
shineParticle = new ParticleType(HeartGem.P_BlueShine) {
107109
Color = Calc.HexToColor("7589FF")

0 commit comments

Comments
 (0)