Static effects / Better shell ejections / Implemented new cannon turret

This commit is contained in:
Anuken
2018-04-04 21:13:49 -04:00
parent 1956fccbe9
commit 05356776c5
54 changed files with 662 additions and 408 deletions
@@ -3,7 +3,8 @@ package io.anuke.mindustry.graphics;
import com.badlogic.gdx.graphics.Color;
public class Palette {
public static final Color bulletYellow = Color.valueOf("f3d47f");
public static final Color bulletYellow = Color.valueOf("ffeec9");
public static final Color bulletYellowBack = Color.valueOf("f9c87a");
public static final Color lightFlame = Color.valueOf("ffdd55");
public static final Color darkFlame = Color.valueOf("db401c");
@@ -12,4 +13,6 @@ public class Palette {
public static final Color lightOrange = Color.valueOf("f68021");
public static final Color lighterOrange = Color.valueOf("f6e096");
public static final Color lightishGray = Color.valueOf("a2a2a2");
}
@@ -1,216 +0,0 @@
package io.anuke.mindustry.graphics.fx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Colors;
import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Fill;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Angles;
import static io.anuke.mindustry.Vars.tilesize;
public class BlockFx {
public static final Effect
reactorsmoke = new Effect(17, e -> {
Angles.randLenVectors(e.id, 4, e.ifract()*8f, (x, y)->{
float size = 1f+e.fract()*5f;
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.ifract());
Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset();
});
}),
nuclearsmoke = new Effect(40, e -> {
Angles.randLenVectors(e.id, 4, e.ifract()*13f, (x, y)->{
float size = e.sfract()*4f;
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.ifract());
Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset();
});
}),
nuclearcloud = new Effect(90, 200f, e -> {
Angles.randLenVectors(e.id, 10, e.powfract()*90f, (x, y)->{
float size = e.fract()*14f;
Draw.color(Color.LIME, Color.GRAY, e.ifract());
Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset();
});
}),
redgeneratespark = new Effect(18, e -> {
Angles.randLenVectors(e.id, 5, e.ifract()*8f, (x, y)->{
float len = e.fract()*4f;
Draw.color(Color.valueOf("fbb97f"), Color.GRAY, e.ifract());
//Draw.alpha(e.fract());
Draw.rect("circle", e.x + x, e.y + y, len, len);
Draw.reset();
});
}),
generatespark = new Effect(18, e -> {
Angles.randLenVectors(e.id, 5, e.ifract()*8f, (x, y)->{
float len = e.fract()*4f;
Draw.color(Color.valueOf("d2b29c"), Color.GRAY, e.ifract());
Draw.rect("circle", e.x + x, e.y + y, len, len);
Draw.reset();
});
}),
fuelburn = new Effect(23, e -> {
Angles.randLenVectors(e.id, 5, e.ifract()*9f, (x, y)->{
float len = e.fract()*4f;
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.ifract());
Draw.rect("circle", e.x + x, e.y + y, len, len);
Draw.reset();
});
}),
plasticburn = new Effect(40, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.ifract()*5f, (x, y)->{
Draw.color(Color.valueOf("e9ead3"), Color.GRAY, e.ifract());
Fill.circle(e.x + x, e.y + y, e.fract()*1f);
Draw.reset();
});
}),
pulverize = new Effect(40, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.ifract()*8f, (x, y)->{
Draw.color(Fx.stoneGray);
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2f + 0.5f, 45);
Draw.reset();
});
}),
pulverizeRed = new Effect(40, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.ifract()*8f, (x, y)->{
Draw.color(Color.valueOf("ffa480"), Fx.stoneGray, e.ifract());
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2f + 0.5f, 45);
Draw.reset();
});
}),
pulverizeRedder = new Effect(40, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.ifract()*9f, (x, y)->{
Draw.color(Color.valueOf("ff7b69"), Fx.stoneGray, e.ifract());
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2.5f + 0.5f, 45);
Draw.reset();
});
}),
pulverizeSmall = new Effect(30, e -> {
Angles.randLenVectors(e.id, 3, e.ifract()*5f, (x, y)->{
Draw.color(Fx.stoneGray);
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 1f + 0.5f, 45);
Draw.reset();
});
}),
pulverizeMedium = new Effect(30, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.ifract()*8f, (x, y)->{
Draw.color(Fx.stoneGray);
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 1f + 0.5f, 45);
Draw.reset();
});
}),
producesmoke = new Effect(12, e -> {
Angles.randLenVectors(e.id, 8, 4f + e.ifract()*18f, (x, y)->{
Draw.color(Color.WHITE, Colors.get("accent"), e.ifract());
Fill.poly(e.x + x, e.y + y, 4, 1f+e.fract()*3f, 45);
Draw.reset();
});
}),
smeltsmoke = new Effect(15, e -> {
Angles.randLenVectors(e.id, 6, 4f + e.ifract()*5f, (x, y)->{
Draw.color(Color.WHITE, e.color, e.ifract());
Fill.poly(e.x + x, e.y + y, 4, 0.5f+e.fract()*2f, 45);
Draw.reset();
});
}),
formsmoke = new Effect(40, e -> {
Angles.randLenVectors(e.id, 6, 5f + e.ifract()*8f, (x, y)->{
Draw.color(Color.valueOf("f1e479"), Color.LIGHT_GRAY, e.ifract());
Fill.poly(e.x + x, e.y + y, 4, 0.2f+e.fract()*2f, 45);
Draw.reset();
});
}),
blastsmoke = new Effect(26, e -> {
Angles.randLenVectors(e.id, 12, 1f + e.ifract()*23f, (x, y)->{
float size = 2f+e.fract()*6f;
Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.ifract());
Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset();
});
}),
lava = new Effect(18, e -> {
Angles.randLenVectors(e.id, 3, 1f + e.ifract()*10f, (x, y)->{
float size = e.sfract()*4f;
Draw.color(Color.ORANGE, Color.GRAY, e.ifract());
Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset();
});
}),
dooropen = new Effect(10, e -> {
Lines.stroke(e.fract() * 1.6f);
Lines.square(e.x, e.y, tilesize / 2f + e.ifract() * 2f);
Draw.reset();
}),
doorclose= new Effect(10, e -> {
Lines.stroke(e.fract() * 1.6f);
Lines.square(e.x, e.y, tilesize / 2f + e.fract() * 2f);
Draw.reset();
}),
dooropenlarge = new Effect(10, e -> {
Lines.stroke(e.fract() * 1.6f);
Lines.square(e.x, e.y, tilesize + e.ifract() * 2f);
Draw.reset();
}),
doorcloselarge = new Effect(10, e -> {
Lines.stroke(e.fract() * 1.6f);
Lines.square(e.x, e.y, tilesize + e.fract() * 2f);
Draw.reset();
}),
purify = new Effect(10, e -> {
Draw.color(Color.ROYAL, Color.GRAY, e.ifract());
Lines.stroke(2f);
Lines.spikes(e.x, e.y, e.ifract() * 4f, 2, 6);
Draw.reset();
}),
purifyoil = new Effect(10, e -> {
Draw.color(Color.BLACK, Color.GRAY, e.ifract());
Lines.stroke(2f);
Lines.spikes(e.x, e.y, e.ifract() * 4f, 2, 6);
Draw.reset();
}),
purifystone = new Effect(10, e -> {
Draw.color(Color.ORANGE, Color.GRAY, e.ifract());
Lines.stroke(2f);
Lines.spikes(e.x, e.y, e.ifract() * 4f, 2, 6);
Draw.reset();
}),
generate = new Effect(11, e -> {
Draw.color(Color.ORANGE, Color.YELLOW, e.ifract());
Lines.stroke(1f);
Lines.spikes(e.x, e.y, e.ifract() * 5f, 2, 8);
Draw.reset();
}),
mine = new Effect(20, e -> {
Angles.randLenVectors(e.id, 6, 3f + e.ifract()*6f, (x, y)->{
Draw.color(e.color, Color.LIGHT_GRAY, e.ifract());
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2f, 45);
Draw.reset();
});
}),
mineBig = new Effect(30, e -> {
Angles.randLenVectors(e.id, 6, 4f + e.ifract()*8f, (x, y)->{
Draw.color(e.color, Color.LIGHT_GRAY, e.ifract());
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2f + 0.2f, 45);
Draw.reset();
});
}),
mineHuge = new Effect(40, e -> {
Angles.randLenVectors(e.id, 8, 5f + e.ifract()*10f, (x, y)->{
Draw.color(e.color, Color.LIGHT_GRAY, e.ifract());
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2f + 0.5f, 45);
Draw.reset();
});
}),
smelt = new Effect(20, e -> {
Angles.randLenVectors(e.id, 6, 2f + e.ifract()*5f, (x, y)->{
Draw.color(Color.WHITE, e.color, e.ifract());
Fill.poly(e.x + x, e.y + y, 4, 0.5f+e.fract()*2f, 45);
Draw.reset();
});
});
}
@@ -1,143 +0,0 @@
package io.anuke.mindustry.graphics.fx;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Fill;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.graphics.Shapes;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
public class BulletFx {
public static final Effect
shootSmall = new Effect(8, e -> {
Draw.color(Palette.lighterOrange, Palette.lightOrange, e.ifract());
float w = 1f + 5 * e.fract();
Shapes.tri(e.x, e.y, w, 15f * e.fract(), e.rotation);
Shapes.tri(e.x, e.y, w, 3f * e.fract(), e.rotation + 180f);
Draw.reset();
}),
shootSmallSmoke = new Effect(20f, e -> {
Draw.color(Palette.lighterOrange, Color.LIGHT_GRAY, Color.GRAY, e.ifract());
Angles.randLenVectors(e.id, 5, e.powfract()*6f, e.rotation, 20f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fract()*1.5f);
});
Draw.reset();
}),
shootBig = new Effect(9, e -> {
Draw.color(Palette.lighterOrange, Palette.lightOrange, e.ifract());
float w = 1.2f + 7 * e.fract();
Shapes.tri(e.x, e.y, w, 25f * e.fract(), e.rotation);
Shapes.tri(e.x, e.y, w, 4f * e.fract(), e.rotation + 180f);
Draw.reset();
}),
shootBigSmoke = new Effect(17f, e -> {
Draw.color(Palette.lighterOrange, Color.LIGHT_GRAY, Color.GRAY, e.ifract());
Angles.randLenVectors(e.id, 8, e.powfract()*19f, e.rotation, 10f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fract()*2f + 0.2f);
});
Draw.reset();
}),
shootSmallFlame = new Effect(30f, e -> {
Draw.color(Palette.lightFlame, Palette.darkFlame, Color.GRAY, e.ifract());
Angles.randLenVectors(e.id, 8, e.powfract()*26f, e.rotation, 10f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.65f + e.fract()*1.5f);
});
Draw.reset();
}),
shellEjectSmall = new Effect(30f, e -> {
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Color.GRAY, e.ifract());
Draw.alpha(e.fract());
float rot = e.rotation + 90f;
for(int i : Mathf.signs){
float len = (2f + e.powfract()*6f) * i;
float lr = rot + e.ifract()*30f*i;
Draw.rect("white", e.x + Angles.trnsx(lr, len), e.y + Angles.trnsy(lr, len), 1f, 2f, rot + e.ifract()*50f*i);
}
Draw.color();
}),
shellEjectBig = new Effect(30f, e -> {
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Color.GRAY, e.ifract());
float rot = e.rotation + 90f;
for(int i : Mathf.signs){
float len = (2f + e.powfract()*10f) * i;
float lr = rot + e.ifract()*20f*i;
Draw.rect("white", e.x + Angles.trnsx(lr, len), e.y + Angles.trnsy(lr, len), 2f, 3f, rot);
}
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.ifract());
for(int i : Mathf.signs){
Angles.randLenVectors(e.id, 4, 1f + e.powfract()*11f, e.rotation + 90f*i, 20f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fract()*1.5f);
});
}
Draw.color();
}),
hitBulletSmall = new Effect(14, e -> {
Draw.color(Color.WHITE, Palette.lightOrange, e.ifract());
Lines.stroke(0.5f + e.fract());
Angles.randLenVectors(e.id, 5, e.ifract()*15f, e.rotation, 50f, (x, y) -> {
float ang = Mathf.atan2(x, y);
Lines.lineAngle(e.x + x, e.y + y, ang, e.fract()*3 + 1f);
});
Draw.reset();
}),
hitBulletBig = new Effect(13, e -> {
Draw.color(Color.WHITE, Palette.lightOrange, e.ifract());
Lines.stroke(0.5f + e.fract()*1.5f);
Angles.randLenVectors(e.id, 8, e.powfract()*30f, e.rotation, 50f, (x, y) -> {
float ang = Mathf.atan2(x, y);
Lines.lineAngle(e.x + x, e.y + y, ang, e.fract()*4 + 1.5f);
});
Draw.reset();
}),
hitFlameSmall = new Effect(14, e -> {
Draw.color(Palette.lightFlame, Palette.darkFlame, e.ifract());
Lines.stroke(0.5f + e.fract());
Angles.randLenVectors(e.id, 5, e.ifract()*15f, e.rotation, 50f, (x, y) -> {
float ang = Mathf.atan2(x, y);
Lines.lineAngle(e.x + x, e.y + y, ang, e.fract()*3 + 1f);
});
Draw.reset();
}),
despawn = new Effect(12, e -> {
Draw.color(Palette.lighterOrange, Color.GRAY, e.ifract());
Lines.stroke(e.fract());
Angles.randLenVectors(e.id, 7, e.ifract()*7f, e.rotation, 40f, (x, y) -> {
float ang = Mathf.atan2(x, y);
Lines.lineAngle(e.x + x, e.y + y, ang, e.fract()*2 + 1f);
});
Draw.reset();
});
}
@@ -1,45 +0,0 @@
package io.anuke.mindustry.graphics.fx;
import com.badlogic.gdx.graphics.Color;
import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Fill;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Angles;
public class ExplosionFx {
public static final Effect
generatorexplosion = new Effect(28, 40f, e -> {
Angles.randLenVectors(e.id, 16, 10f + e.ifract()*8f, (x, y)->{
float size = e.fract()*12f + 1f;
Draw.color(Color.WHITE, Color.PURPLE, e.ifract());
Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset();
});
}),
shockwave = new Effect(10f, 80f, e -> {
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract());
Lines.stroke(e.fract()*2f + 0.2f);
Lines.circle(e.x, e.y, e.ifract()*28f);
Draw.reset();
}),
nuclearShockwave = new Effect(10f, 200f, e -> {
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract());
Lines.stroke(e.fract()*3f + 0.2f);
Lines.poly(e.x, e.y, 40, e.ifract()*140f);
Draw.reset();
}),
explosion = new Effect(11, e -> {
Lines.stroke(2f*e.fract()+0.5f);
Draw.color(Color.WHITE, Color.DARK_GRAY, e.powfract());
Lines.circle(e.x, e.y, 5f + e.powfract() * 6f);
Draw.color(e.ifract() < 0.5f ? Color.WHITE : Color.DARK_GRAY);
Angles.randLenVectors(e.id, 5, 8f, (x, y)->{
Fill.circle(e.x + x, e.y + y, e.fract()*5f + 2.5f);
});
Draw.reset();
});
}
@@ -1,61 +0,0 @@
package io.anuke.mindustry.graphics.fx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Colors;
import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Lines;
import static io.anuke.mindustry.Vars.respawnduration;
import static io.anuke.mindustry.Vars.tilesize;
public class Fx{
public static Color beam = Color.valueOf("9bffbe");
public static Color stoneGray = Color.valueOf("8f8f8f");
public static final Effect
none = new Effect(0, 0f, e->{}),
place = new Effect(16, e -> {
Lines.stroke(3f - e.ifract() * 2f);
Lines.square(e.x, e.y, tilesize / 2f + e.ifract() * 3f);
Draw.reset();
}),
breakBlock = new Effect(12, e -> {
Lines.stroke(2f);
Draw.color(Color.WHITE, Colors.get("break"), e.ifract());
Lines.spikes(e.x, e.y, e.ifract() * 6f, 2, 5, 90);
Draw.reset();
}),
smoke = new Effect(100, e -> {
Draw.color(Color.GRAY, new Color(0.3f, 0.3f, 0.3f, 1f), e.ifract());
float size = 7f-e.ifract()*7f;
Draw.rect("circle", e.x, e.y, size, size);
Draw.reset();
}),
dash = new Effect(30, e -> {
Draw.color(Color.CORAL, Color.GRAY, e.ifract());
float size = e.fract()*4f;
Draw.rect("circle", e.x, e.y, size, size);
Draw.reset();
}),
spawn = new Effect(23, e -> {
Lines.stroke(2f);
Draw.color(Color.DARK_GRAY, Color.SCARLET, e.ifract());
Lines.circle(e.x, e.y, 7f - e.ifract() * 6f);
Draw.reset();
}),
respawn = new Effect(respawnduration, e -> {
Draw.tcolor(Color.SCARLET);
Draw.tscl(0.25f);
Draw.text("Respawning in " + (int)((e.lifetime-e.time)/60), e.x, e.y);
Draw.tscl(0.5f);
Draw.reset();
});
}