Better continuous laser bullet visuals
This commit is contained in:
@@ -473,7 +473,7 @@ public class UnitTypes{
|
||||
mirror = false;
|
||||
top = false;
|
||||
shake = 4f;
|
||||
shootY = 13f;
|
||||
shootY = 14f;
|
||||
x = y = 0f;
|
||||
|
||||
shoot.firstShotDelay = Fx.greenLaserChargeSmall.lifetime - 1f;
|
||||
@@ -3339,7 +3339,6 @@ public class UnitTypes{
|
||||
}};
|
||||
|
||||
obviate = new ErekirUnitType("obviate"){{
|
||||
lowAltitude = false;
|
||||
flying = true;
|
||||
drag = 0.08f;
|
||||
speed = 1.9f;
|
||||
@@ -3352,10 +3351,50 @@ public class UnitTypes{
|
||||
engineOffset = 54f / 4f;
|
||||
fogRadius = 25;
|
||||
itemCapacity = 0;
|
||||
lowAltitude = true;
|
||||
|
||||
setEnginesMirror(
|
||||
new UnitEngine(59 / 4f, -25 / 4f, 3.1f, 315f)
|
||||
);
|
||||
|
||||
parts.add(new RegionPart("-heat"){{
|
||||
blending = Blending.additive;
|
||||
progress = PartProgress.heat;
|
||||
outline = false;
|
||||
colorTo = new Color(1f, 0.5f, 0.5f, 0.7f);
|
||||
color = colorTo.cpy().a(0f);
|
||||
layerOffset = 0.01f;
|
||||
}});
|
||||
|
||||
//TODO this is really dumb.
|
||||
weapons.add(new Weapon(){{
|
||||
y = 2f;
|
||||
shootY = 0f;
|
||||
x = 0f;
|
||||
reload = 140f;
|
||||
mirror = false;
|
||||
continuous = true;
|
||||
// minWarmup = 0.5f;
|
||||
|
||||
bullet = new ContinuousLaserBulletType(140){{
|
||||
shake = 0f;
|
||||
lifetime = 120f;
|
||||
colors = new Color[]{Color.valueOf("bf92f9").a(0.4f), Color.valueOf("bf92f9"), Color.white};
|
||||
//TODO merge
|
||||
chargeEffect = new MultiEffect(Fx.lancerLaserCharge, Fx.lancerLaserChargeBegin);
|
||||
width = 20f;
|
||||
largeHit = false;
|
||||
|
||||
buildingDamageMultiplier = 0.25f;
|
||||
hitEffect = Fx.hitLancer;
|
||||
hitSize = 4;
|
||||
drawSize = 400f;
|
||||
length = 173f;
|
||||
ammoMultiplier = 1f;
|
||||
pierceCap = 4;
|
||||
hitColor = colors[1];
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
|
||||
quell = new ErekirUnitType("quell"){{
|
||||
|
||||
@@ -30,7 +30,6 @@ public class Damage{
|
||||
|
||||
private static Tile furthest;
|
||||
private static float maxDst = 0f;
|
||||
private static int pierceCount = 0;
|
||||
private static Building tmpBuilding;
|
||||
private static Unit tmpUnit;
|
||||
|
||||
@@ -149,7 +148,6 @@ public class Damage{
|
||||
vec.trnsExact(b.rotation(), length);
|
||||
rect.setPosition(b.x, b.y).setSize(vec.x, vec.y).normalize().grow(3f);
|
||||
|
||||
pierceCount = 0;
|
||||
maxDst = Float.POSITIVE_INFINITY;
|
||||
|
||||
distances.clear();
|
||||
@@ -219,7 +217,6 @@ public class Damage{
|
||||
* Only enemies of the specified team are damaged.
|
||||
*/
|
||||
public static void collideLine(Bullet hitter, Team team, Effect effect, float x, float y, float angle, float length, boolean large, boolean laser, int pierceCap){
|
||||
pierceCount = 0;
|
||||
if(laser){
|
||||
length = findLaserLength(hitter, length);
|
||||
}else if(pierceCap > 0){
|
||||
@@ -284,8 +281,6 @@ public class Damage{
|
||||
effect.at(vec.x, vec.y);
|
||||
e.collision(hitter, vec.x, vec.y);
|
||||
hitter.collision(e, vec.x, vec.y);
|
||||
|
||||
pierceCount ++;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -23,12 +23,12 @@ public class ContinuousFlameBulletType extends ContinuousBulletType{
|
||||
public Interp lengthInterp = Interp.slope;
|
||||
|
||||
/** Lengths, widths, ellipse panning, and offsets, all as fractions of the base width and length. Stored as an 'interleaved' array of values: LWPO1 LWPO2 LWPO3... */
|
||||
public float[] lengthWidthPanOffsets = {
|
||||
1.12f, 1.3f, 0.32f, 0f,
|
||||
1f, 1f, 0.3f, 0f,
|
||||
0.8f, 0.9f, 0.2f, 0.01f,
|
||||
0.5f, 0.8f, 0.15f, 0.02f,
|
||||
0.25f, 0.7f, 0.1f, 0.03f
|
||||
public float[] lengthWidthPans = {
|
||||
1.12f, 1.3f, 0.32f,
|
||||
1f, 1f, 0.3f,
|
||||
0.8f, 0.9f, 0.2f,
|
||||
0.5f, 0.8f, 0.15f,
|
||||
0.25f, 0.7f, 0.1f,
|
||||
};
|
||||
|
||||
public Color[] colors = {Color.valueOf("eb7abe").a(0.55f), Color.valueOf("e189f5").a(0.7f), Color.valueOf("907ef7").a(0.8f), Color.valueOf("91a4ff"), Color.white.cpy()};
|
||||
@@ -64,10 +64,9 @@ public class ContinuousFlameBulletType extends ContinuousBulletType{
|
||||
for(int i = 0; i < colors.length; i++){
|
||||
Draw.color(colors[i].write(Tmp.c1).mul(0.9f).mul(1f + Mathf.absin(Time.time, 1f, 0.1f)));
|
||||
Drawf.flame(b.x, b.y, divisions, b.rotation(),
|
||||
realLength * lengthWidthPanOffsets[i * 4] * (1f - sin),
|
||||
width * lengthWidthPanOffsets[i * 4 + 1] * mult * (1f + sin),
|
||||
lengthWidthPanOffsets[i * 4 + 2],
|
||||
realLength * lengthWidthPanOffsets[i * 4 + 3]
|
||||
realLength * lengthWidthPans[i * 3] * (1f - sin),
|
||||
width * lengthWidthPans[i * 3 + 1] * mult * (1f + sin),
|
||||
lengthWidthPans[i * 3 + 2]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,11 +12,11 @@ import mindustry.graphics.*;
|
||||
public class ContinuousLaserBulletType extends ContinuousBulletType{
|
||||
public float fadeTime = 16f;
|
||||
public float lightStroke = 40f;
|
||||
public float spaceMag = 35f;
|
||||
public int divisions = 11;
|
||||
public Color[] colors = {Color.valueOf("ec745855"), Color.valueOf("ec7458aa"), Color.valueOf("ff9c5a"), Color.white};
|
||||
public float[] tscales = {1f, 0.7f, 0.5f, 0.2f};
|
||||
public float[] strokes = {2f, 1.5f, 1f, 0.3f};
|
||||
public float[] lenscales = {1f, 1.12f, 1.15f, 1.17f};
|
||||
public float[] strokes = {2f, 1.5f, 1f, 0.5f};
|
||||
|
||||
public float backLength = 7f, frontLength = 35f;
|
||||
public float width = 9f, oscScl = 0.8f, oscMag = 1.5f;
|
||||
|
||||
public ContinuousLaserBulletType(float damage){
|
||||
@@ -45,15 +45,23 @@ public class ContinuousLaserBulletType extends ContinuousBulletType{
|
||||
float realLength = Damage.findLaserLength(b, length);
|
||||
float fout = Mathf.clamp(b.time > b.lifetime - fadeTime ? 1f - (b.time - (lifetime - fadeTime)) / fadeTime : 1f);
|
||||
float baseLen = realLength * fout;
|
||||
float rot = b.rotation();
|
||||
|
||||
Lines.lineAngle(b.x, b.y, b.rotation(), baseLen);
|
||||
for(int s = 0; s < colors.length; s++){
|
||||
Draw.color(Tmp.c1.set(colors[s]).mul(1f + Mathf.absin(Time.time, 1f, 0.1f)));
|
||||
for(int i = 0; i < tscales.length; i++){
|
||||
Tmp.v1.trns(b.rotation() + 180f, (lenscales[i] - 1f) * spaceMag);
|
||||
Lines.stroke((width + Mathf.absin(Time.time, oscScl, oscMag)) * fout * strokes[s] * tscales[i]);
|
||||
Lines.lineAngle(b.x + Tmp.v1.x, b.y + Tmp.v1.y, b.rotation(), baseLen * lenscales[i], false);
|
||||
}
|
||||
for(int i = 0; i < colors.length; i++){
|
||||
Draw.color(Tmp.c1.set(colors[i]).mul(1f + Mathf.absin(Time.time, 1f, 0.1f)));
|
||||
|
||||
float stroke = (width + Mathf.absin(Time.time, oscScl, oscMag)) * fout * strokes[i];
|
||||
float ellipseLenScl = Mathf.lerp(strokes[i] / 2f, 1f, 0.75f);
|
||||
Lines.stroke(stroke);
|
||||
|
||||
Lines.lineAngle(b.x, b.y, rot, length - frontLength, false);
|
||||
|
||||
//back ellipse
|
||||
Drawf.flameFront(b.x, b.y, divisions, rot + 180f, backLength, stroke / 2f);
|
||||
|
||||
//front ellipse
|
||||
Tmp.v1.trnsExact(rot, length - frontLength);
|
||||
Drawf.flameFront(b.x + Tmp.v1.x, b.y + Tmp.v1.y, divisions, rot, frontLength * ellipseLenScl, stroke / 2f);
|
||||
}
|
||||
|
||||
Tmp.v1.trns(b.rotation(), baseLen * 1.1f);
|
||||
|
||||
@@ -104,7 +104,7 @@ public class LaserBulletType extends BulletType{
|
||||
Lines.stroke((cwidth *= lengthFalloff) * b.fout());
|
||||
Lines.lineAngle(b.x, b.y, b.rotation(), baseLen, false);
|
||||
Tmp.v1.trns(b.rotation(), baseLen);
|
||||
Drawf.tri(b.x + Tmp.v1.x, b.y + Tmp.v1.y, Lines.getStroke() * 1.22f, cwidth * 2f + width / 2f, b.rotation());
|
||||
Drawf.tri(b.x + Tmp.v1.x, b.y + Tmp.v1.y, Lines.getStroke(), cwidth * 2f + width / 2f, b.rotation());
|
||||
|
||||
Fill.circle(b.x, b.y, 1f * cwidth * b.fout());
|
||||
for(int i : Mathf.signs){
|
||||
|
||||
@@ -18,12 +18,8 @@ public class Drawf{
|
||||
private static final Vec2[] vecs = new Vec2[]{new Vec2(), new Vec2(), new Vec2(), new Vec2()};
|
||||
private static final FloatSeq points = new FloatSeq();
|
||||
|
||||
public static void flame(float x, float y, int divisions, float rotation, float length, float width, float pan){
|
||||
flame(x, y, divisions, rotation, length, width, pan, 0f);
|
||||
}
|
||||
|
||||
//TODO offset unused
|
||||
public static void flame(float x, float y, int divisions, float rotation, float length, float width, float pan, float offset){
|
||||
public static void flame(float x, float y, int divisions, float rotation, float length, float width, float pan){
|
||||
float len1 = length * pan, len2 = length * (1f - pan);
|
||||
|
||||
points.clear();
|
||||
@@ -57,6 +53,27 @@ public class Drawf{
|
||||
Fill.poly(points);
|
||||
}
|
||||
|
||||
public static void flameFront(float x, float y, int divisions, float rotation, float length, float width){
|
||||
divisions = Mathf.round(divisions, 2) + 1;
|
||||
|
||||
points.clear();
|
||||
|
||||
//right side; half arc beginning at -90 (270) and ending at 90
|
||||
for(int i = 0; i <= divisions; i++){
|
||||
float rot = -90f + 180f * i / (float)divisions;
|
||||
Tmp.v1.trnsExact(rot, width);
|
||||
|
||||
point(
|
||||
(Tmp.v1.x) / width * length, //convert to 0..1, then multiply by desired length and offset relative to previous segment
|
||||
Tmp.v1.y, //Y axis remains unchanged
|
||||
x, y,
|
||||
rotation
|
||||
);
|
||||
}
|
||||
|
||||
Fill.poly(points);
|
||||
}
|
||||
|
||||
private static void point(float x, float y, float baseX, float baseY, float rotation){
|
||||
//TODO test exact and non-exact
|
||||
Tmp.v1.set(x, y).rotateRadExact(rotation * Mathf.degRad);
|
||||
|
||||
Reference in New Issue
Block a user