More effect tweaks / Unfinished implementation of lancer turret

This commit is contained in:
Anuken
2018-04-04 23:50:27 -04:00
parent 05356776c5
commit 62608bea6c
16 changed files with 340 additions and 308 deletions
@@ -12,5 +12,7 @@ public class AmmoTypes {
basicFlame = new AmmoType(Liquids.oil, TurretBullets.basicFlame, 0.3f, 0.9f),
basicLeadFrag = new AmmoType(Items.lead, TurretBullets.basicLeadFragShell, 1, 0.8f);
basicLeadFrag = new AmmoType(Items.lead, TurretBullets.basicLeadFragShell, 1, 0.8f),
lancerLaser = new AmmoType(TurretBullets.lancerLaser);
}
@@ -4,7 +4,6 @@ import io.anuke.mindustry.content.AmmoTypes;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.resource.AmmoType;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.types.defense.LaserTurret;
import io.anuke.mindustry.world.blocks.types.defense.Turret;
import io.anuke.mindustry.world.blocks.types.defense.turrets.*;
import io.anuke.ucore.graphics.Draw;
@@ -91,9 +90,14 @@ public class WeaponBlocks{
};
}},
laserturret = new LaserTurret("laserturret"){
},
laserturret = new PowerTurret("laserturret"){{
range = 70f;
shootType = AmmoTypes.lancerLaser;
recoil = 2f;
reload = 80f;
shootEffect = BulletFx.lancerLaserShoot;
smokeEffect = BulletFx.lancerLaserShootSmoke;
}},
teslaturret = new PowerTurret("teslaturret"){
@@ -5,8 +5,10 @@ import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.entities.Bullet;
import io.anuke.mindustry.entities.BulletType;
import io.anuke.mindustry.entities.effect.DamageArea;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
@@ -74,16 +76,17 @@ public class TurretBullets {
hiteffect = Fx.none;
despawneffect = Fx.none;
hitsize = 4;
lifetime = 20f;
}
@Override
public void draw(Bullet b) {
drawBullet(Palette.bulletYellow, Palette.bulletYellowBack,
"bullet", b.x, b.y, 10f, 1f + b.fract()*11f, b.angle() - 90);
"bullet", b.x, b.y, 7f + b.fract()*3f, 1f + b.fract()*11f, b.angle() - 90);
}
},
basicFlame = new BulletType(2f, 4) {
basicFlame = new BulletType(2f, 0) {
{
hitsize = 7f;
lifetime = 30f;
@@ -95,6 +98,39 @@ public class TurretBullets {
@Override
public void draw(Bullet b) {}
},
lancerLaser = new BulletType(0.001f, 1) {
Color[] colors = {Palette.lancerLaser.cpy().mul(1f, 1f, 1f, 0.4f), Palette.lancerLaser, Color.WHITE};
float[] tscales = {1f, 0.7f, 0.5f, 0.2f};
float[] lenscales = {1f, 1.1f, 1.13f, 1.14f};
float length = 70f;
{
hiteffect = BulletFx.hitLancer;
despawneffect = Fx.none;
hitsize = 4;
lifetime = 12f;
pierce = true;
}
@Override
public void init(Bullet b) {
DamageArea.collideLine(b, b.team, hiteffect, b.x, b.y, b.angle(), length);
}
@Override
public void draw(Bullet b) {
Lines.lineAngle(b.x, b.y, b.angle(), length);
for(int s = 0; s < 3; s ++) {
Draw.color(colors[s]);
for (int i = 0; i < tscales.length; i++) {
Lines.stroke(7f * b.fract() * (s == 0 ? 1.5f : s == 1 ? 1f : 0.3f) * tscales[i]);
Lines.lineAngle(b.x, b.y, b.angle(), length * lenscales[i]);
}
}
Draw.reset();
}
};
private static void drawBullet(Color first, Color second, String name, float x, float y, float w, float h, float rot){
@@ -80,7 +80,7 @@ public class BulletFx {
Draw.reset();
}),
shellEjectSmall = new StaticEffect(30f, 300f, e -> {
shellEjectSmall = new StaticEffect(30f, 400f, e -> {
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.ifract());
float rot = e.rotation + 90f;
for(int i : Mathf.signs){
@@ -95,7 +95,7 @@ public class BulletFx {
Draw.color();
}),
shellEjectMedium = new StaticEffect(34f, 300f, e -> {
shellEjectMedium = new StaticEffect(34f, 400f, e -> {
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.ifract());
float rot = e.rotation + 90f;
for(int i : Mathf.signs){
@@ -118,7 +118,7 @@ public class BulletFx {
Draw.color();
}),
shellEjectBig = new StaticEffect(22f, 300f, e -> {
shellEjectBig = new StaticEffect(22f, 400f, e -> {
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.ifract());
float rot = e.rotation + 90f;
for(int i : Mathf.signs){
@@ -178,6 +178,18 @@ public class BulletFx {
Draw.reset();
}),
hitLancer = new Effect(12, e -> {
Draw.color(Color.WHITE);
Lines.stroke(e.fract()*1.5f);
Angles.randLenVectors(e.id, 8, e.powfract()*17f, e.rotation, 360f, (x, y) -> {
float ang = Mathf.atan2(x, y);
Lines.lineAngle(e.x + x, e.y + y, ang, e.fract()*4 + 1f);
});
Draw.reset();
}),
despawn = new Effect(12, e -> {
Draw.color(Palette.lighterOrange, Color.GRAY, e.ifract());
Lines.stroke(e.fract());
@@ -211,6 +223,26 @@ public class BulletFx {
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), 1f + e.fract()*3f);
});
Draw.reset();
}),
lancerLaserShoot = new Effect(12f, e -> {
Draw.color(Palette.lancerLaser);
for(int i : Mathf.signs){
Shapes.tri(e.x, e.y, 4f * e.fract(), 29f, e.rotation + 90f*i);
}
Draw.reset();
}),
lancerLaserShootSmoke = new Effect(20f, e -> {
Draw.color(Palette.lancerLaser);
Angles.randLenVectors(e.id, 7, 80f, e.rotation, 0f, (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), e.fract()*9f);
});
Draw.reset();
});
}