casing flipping (#6696)

This commit is contained in:
Chaos Incarnate
2022-04-05 08:23:23 -07:00
committed by GitHub
parent 41b22ba6a6
commit 43e421936d

View File

@@ -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;