Added laser bullet type
This commit is contained in:
@@ -492,47 +492,13 @@ public class Bullets implements ContentList{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
lancerLaser = new BulletType(0.001f, 140){
|
lancerLaser = new LaserBulletType(140){{
|
||||||
Color[] colors = {Pal.lancerLaser.cpy().mul(1f, 1f, 1f, 0.4f), Pal.lancerLaser, Color.white};
|
colors = new Color[]{Pal.lancerLaser.cpy().mul(1f, 1f, 1f, 0.4f), Pal.lancerLaser, Color.white};
|
||||||
float[] tscales = {1f, 0.7f, 0.5f, 0.2f};
|
hitEffect = Fx.hitLancer;
|
||||||
float[] lenscales = {1f, 1.1f, 1.13f, 1.14f};
|
despawnEffect = Fx.none;
|
||||||
float length = 160f;
|
hitSize = 4;
|
||||||
|
lifetime = 16f;
|
||||||
{
|
}};
|
||||||
hitEffect = Fx.hitLancer;
|
|
||||||
despawnEffect = Fx.none;
|
|
||||||
hitSize = 4;
|
|
||||||
lifetime = 16f;
|
|
||||||
pierce = true;
|
|
||||||
keepVelocity = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float range(){
|
|
||||||
return length;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(Bullet b){
|
|
||||||
Damage.collideLine(b, b.getTeam(), hitEffect, b.x, b.y, b.rot(), length);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void draw(Bullet b){
|
|
||||||
float f = Mathf.curve(b.fin(), 0f, 0.2f);
|
|
||||||
float baseLen = length * f;
|
|
||||||
|
|
||||||
Lines.lineAngle(b.x, b.y, b.rot(), baseLen);
|
|
||||||
for(int s = 0; s < 3; s++){
|
|
||||||
Draw.color(colors[s]);
|
|
||||||
for(int i = 0; i < tscales.length; i++){
|
|
||||||
Lines.stroke(7f * b.fout() * (s == 0 ? 1.5f : s == 1 ? 1f : 0.3f) * tscales[i]);
|
|
||||||
Lines.lineAngle(b.x, b.y, b.rot(), baseLen * lenscales[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
meltdownLaser = new BulletType(0.001f, 70){
|
meltdownLaser = new BulletType(0.001f, 70){
|
||||||
Color tmpColor = new Color();
|
Color tmpColor = new Color();
|
||||||
|
|||||||
@@ -855,9 +855,9 @@ public class Fx implements ContentList{
|
|||||||
});
|
});
|
||||||
|
|
||||||
lancerLaserShootSmoke = new Effect(26f, e -> {
|
lancerLaserShootSmoke = new Effect(26f, e -> {
|
||||||
Draw.color(Pal.lancerLaser);
|
Draw.color(Color.white);
|
||||||
|
|
||||||
Angles.randLenVectors(e.id, 7, 80f, e.rotation, 0f, (x, y) -> {
|
Angles.randLenVectors(e.id, 7, 70f, e.rotation, 0f, (x, y) -> {
|
||||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fout() * 9f);
|
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fout() * 9f);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -874,7 +874,7 @@ public class Fx implements ContentList{
|
|||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
lancerLaserChargeBegin = new Effect(71f, e -> {
|
lancerLaserChargeBegin = new Effect(60f, e -> {
|
||||||
Draw.color(Pal.lancerLaser);
|
Draw.color(Pal.lancerLaser);
|
||||||
Fill.circle(e.x, e.y, e.fin() * 3f);
|
Fill.circle(e.x, e.y, e.fin() * 3f);
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class Mechs implements ContentList{
|
|||||||
mass = 0.9f;
|
mass = 0.9f;
|
||||||
health = 150f;
|
health = 150f;
|
||||||
buildPower = 0.9f;
|
buildPower = 0.9f;
|
||||||
weaponOffsetX = -1;
|
weaponOffsetX = 1;
|
||||||
weaponOffsetY = -1;
|
weaponOffsetY = -1;
|
||||||
engineColor = Color.valueOf("d3ddff");
|
engineColor = Color.valueOf("d3ddff");
|
||||||
|
|
||||||
@@ -82,9 +82,14 @@ public class Mechs implements ContentList{
|
|||||||
length = 1f;
|
length = 1f;
|
||||||
reload = 60f;
|
reload = 60f;
|
||||||
roundrobin = true;
|
roundrobin = true;
|
||||||
ejectEffect = Fx.none;
|
|
||||||
bullet = Bullets.lancerLaser;
|
bullet = Bullets.lancerLaser;
|
||||||
shootSound = Sounds.spark;
|
shootSound = Sounds.spark;
|
||||||
|
|
||||||
|
bullet = new LaserBulletType(20f){{
|
||||||
|
recoil = 1f;
|
||||||
|
sideAngle = 45f;
|
||||||
|
colors = new Color[]{Pal.heal.cpy().mul(1, 1, 1, 0.4f), Pal.heal, Color.white};
|
||||||
|
}};
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package io.anuke.mindustry.entities.bullet;
|
||||||
|
|
||||||
|
import io.anuke.arc.graphics.*;
|
||||||
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
|
import io.anuke.arc.math.*;
|
||||||
|
import io.anuke.arc.util.*;
|
||||||
|
import io.anuke.mindustry.content.*;
|
||||||
|
import io.anuke.mindustry.entities.*;
|
||||||
|
import io.anuke.mindustry.entities.type.*;
|
||||||
|
import io.anuke.mindustry.graphics.*;
|
||||||
|
|
||||||
|
public class LaserBulletType extends BulletType{
|
||||||
|
protected Color[] colors = {Pal.lancerLaser.cpy().mul(1f, 1f, 1f, 0.4f), Pal.lancerLaser, Color.white};
|
||||||
|
protected float length = 160f;
|
||||||
|
protected float width = 15f;
|
||||||
|
protected float lengthFalloff = 0.5f;
|
||||||
|
protected float sideLength = 29f, sideWidth = 0.7f;
|
||||||
|
protected float sideAngle = 90f;
|
||||||
|
|
||||||
|
public LaserBulletType(float damage){
|
||||||
|
super(0.01f, damage);
|
||||||
|
|
||||||
|
keepVelocity = false;
|
||||||
|
hitEffect = Fx.hitLancer;
|
||||||
|
despawnEffect = Fx.none;
|
||||||
|
shootEffect = Fx.hitLancer;
|
||||||
|
smokeEffect = Fx.lancerLaserShootSmoke;
|
||||||
|
hitSize = 4;
|
||||||
|
lifetime = 16f;
|
||||||
|
pierce = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float range(){
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Bullet b){
|
||||||
|
Damage.collideLine(b, b.getTeam(), hitEffect, b.x, b.y, b.rot(), length);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Bullet b){
|
||||||
|
float f = Mathf.curve(b.fin(), 0f, 0.2f);
|
||||||
|
float baseLen = length * f;
|
||||||
|
float cwidth = width;
|
||||||
|
float compound = 1f;
|
||||||
|
|
||||||
|
Lines.lineAngle(b.x, b.y, b.rot(), baseLen);
|
||||||
|
Lines.precise(true);
|
||||||
|
for(Color color : colors){
|
||||||
|
Draw.color(color);
|
||||||
|
Lines.stroke((cwidth *= lengthFalloff) * b.fout());
|
||||||
|
Lines.lineAngle(b.x, b.y, b.rot(), baseLen, CapStyle.none);
|
||||||
|
Tmp.v1.trns(b.rot(), baseLen);
|
||||||
|
Drawf.tri(b.x + Tmp.v1.x, b.y + Tmp.v1.y, Lines.getStroke() * 1.22f, cwidth * 2f + width / 2f, b.rot());
|
||||||
|
|
||||||
|
Fill.circle(b.x, b.y, 1f * cwidth * b.fout());
|
||||||
|
for(int i : Mathf.signs){
|
||||||
|
Drawf.tri(b.x, b.y, sideWidth * b.fout() * cwidth, sideLength * compound, b.rot() + sideAngle * i);
|
||||||
|
}
|
||||||
|
|
||||||
|
compound *= lengthFalloff;
|
||||||
|
}
|
||||||
|
Lines.precise(false);
|
||||||
|
Draw.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user