Skip to content

Commit 3f4e0f5

Browse files
authored
Merge pull request #107 from AdamKorinek/pufferfix
Fixed static custom puffer starting position
2 parents 90ca6d0 + 00aec40 commit 3f4e0f5

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

Code/FLCC/CustomPuffer.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public enum BoostModes
8282
private bool tangible = true;
8383
private bool renderEye = true;
8484

85-
public CustomPuffer(Vector2 position, bool faceRight, float angle = 0f, float radius = 32f, float launchSpeed = 280f, string spriteName = "pufferFish")
85+
public CustomPuffer(Vector2 position, bool faceRight, float angle = 0f, float radius = 32f, float launchSpeed = 280f, string spriteName = "pufferFish", bool isStatic = false)
8686
: base(position)
8787
{
8888
Collider = new Hitbox(12f, 10f, -6f, -5f);
@@ -98,8 +98,12 @@ public CustomPuffer(Vector2 position, bool faceRight, float angle = 0f, float ra
9898
Facing.X = -1f;
9999
}
100100
idleSine = new SineWave(0.5f, 0f);
101-
idleSine.Randomize();
102-
Add(idleSine);
101+
if(!isStatic)
102+
{
103+
idleSine.Randomize();
104+
}
105+
this.isStatic = isStatic;
106+
Add(idleSine);
103107
anchorPosition = Position;
104108
Position += new Vector2(idleSine.Value * 3f, idleSine.ValueOverTwo * 2f);
105109
State = States.Idle;
@@ -122,13 +126,12 @@ public CustomPuffer(Vector2 position, bool faceRight, float angle = 0f, float ra
122126
}
123127

124128
public CustomPuffer(EntityData data, Vector2 offset, EntityID id)
125-
: this(data.Position + offset, data.Bool("right", false), data.Float("angle", 0f), data.Float("radius", 32f), data.Float("launchSpeed", 280f), data.Attr("sprite", "pufferFish"))
129+
: this(data.Position + offset, data.Bool("right", false), data.Float("angle", 0f), data.Float("radius", 32f), data.Float("launchSpeed", 280f), data.Attr("sprite", "pufferFish"), data.Bool("static",false))
126130
{
127131
ID = id;
128132

129133
respawnTime = data.Float("respawnTime", 2.5f);
130134
alwaysShowOutline = data.Bool("alwaysShowOutline");
131-
isStatic = data.Bool("static");
132135
pushAny = data.Bool("pushAnyDir");
133136
oneUse = data.Bool("oneUse");
134137
deathFlag = data.Attr("deathFlag");

0 commit comments

Comments
 (0)