/** * Convenience method to produce an explosion, splash, or burst effect. Calls * {@link #summon(float, int, int, int, int, char, Color, Color, boolean, float, float, float)} repeatedly with * different parameters. As with summon(), this creates temporary Actors that change color, position, and rotation. * This overload always moves Actors 1 cell away, which is a safe default, uses a "normal" amount of rotation for * for all of the actors (a value of 1f if you used another overload), and always uses an end color that is a * modified copy of startColor with 0 alpha (making the Actors all fade to transparent). The parameter * eightWay determines whether this produces 4 (cardinal) or 8 (cardinal and diagonal) rotations and directions. * @param x the starting, center, x-position to create all Actors at * @param y the starting, center, y-position to create all Actors at * @param eightWay if true, creates 8 Actors and moves them away in a square, otherwise, 4 Actors in a diamond * @param glyph the char to make a rotate-able Actor of; should definitely be visible * @param startColor the color to start the effect with * @param duration how long, in seconds, the effect should last */ public void burst(int x, int y, boolean eightWay, char glyph, Color startColor, float duration) { burst(0f, x, y, 1, eightWay, glyph, startColor, startColor.cpy().sub(0,0,0,1), false, 1f, duration); }
public int additiveBlend(int pixelColor, SplatTexture.Channel channel, float strength) { c0.set(pixelColor); if (channel == SplatTexture.Channel.BASE) { c0.sub(strength, strength, strength, strength); } else if (channel == SplatTexture.Channel.R) { c0.add(strength, 0, 0, 0); } else if (channel == SplatTexture.Channel.G) { c0.add(0, strength, 0, 0); } else if (channel == SplatTexture.Channel.B) { c0.add(0, 0, strength, 0); } else if (channel == SplatTexture.Channel.A) { c0.add(0, 0, 0, strength); } // prevent the sum to be greater than 1 final float sum = c0.r + c0.g + c0.b + c0.a; if (sum > 1f) { final float correction = 1f / sum; c0.r *= correction; c0.g *= correction; c0.b *= correction; c0.a *= correction; } return Color.rgba8888(c0); }