From 43e421936d146ee822d0ccd618e3e28d9ca0b5cf Mon Sep 17 00:00:00 2001 From: Chaos Incarnate <54301439+MEEPofFaith@users.noreply.github.com> Date: Tue, 5 Apr 2022 08:23:23 -0700 Subject: [PATCH] casing flipping (#6696) --- core/src/mindustry/entities/effect/ParticleEffect.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/entities/effect/ParticleEffect.java b/core/src/mindustry/entities/effect/ParticleEffect.java index 7fedbe189e..39213eef35 100644 --- a/core/src/mindustry/entities/effect/ParticleEffect.java +++ b/core/src/mindustry/entities/effect/ParticleEffect.java @@ -17,6 +17,8 @@ public class ParticleEffect extends Effect{ public Color colorFrom = Color.white.cpy(), colorTo = Color.white.cpy(); public int particles = 6; public boolean randLength = true; + /** Gives the effect flipping compatability like casing effects. */ + public boolean casingFlip; public float cone = 180f, length = 20f, baseLength = 0f; /** Particle size/length/radius interpolation. */ public Interp interp = Interp.linear; @@ -55,11 +57,12 @@ public class ParticleEffect extends Effect{ public void render(EffectContainer e){ if(tex == null) tex = Core.atlas.find(region); - float realRotation = (useRotation ? e.rotation : baseRotation); + float realRotation = (useRotation ? (casingFlip ? Math.abs(e.rotation) : e.rotation) : baseRotation); + int flip = casingFlip ? -Mathf.sign(e.rotation) : 1; float rawfin = e.fin(); float fin = e.fin(interp); float rad = sizeInterp.apply(sizeFrom, sizeTo, rawfin) * 2; - float ox = e.x + Angles.trnsx(realRotation, offsetX, offsetY), oy = e.y + Angles.trnsy(realRotation, offsetX, offsetY); + float ox = e.x + Angles.trnsx(realRotation, offsetX * flip, offsetY), oy = e.y + Angles.trnsy(realRotation, offsetX * flip, offsetY); Draw.color(colorFrom, colorTo, fin); Color lightColor = this.lightColor == null ? Draw.getColor() : this.lightColor;