Better continuous laser bullet visuals
This commit is contained in:
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user