Implemented 'railgun' turret / Hierarchy split / Color refactoring

This commit is contained in:
Anuken
2018-04-04 16:44:32 -04:00
parent 641a4b87c6
commit 1956fccbe9
19 changed files with 449 additions and 307 deletions
@@ -0,0 +1,15 @@
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 lightFlame = Color.valueOf("ffdd55");
public static final Color darkFlame = Color.valueOf("db401c");
public static final Color turretHeat = Color.valueOf("ab3400");
public static final Color lightOrange = Color.valueOf("f68021");
public static final Color lighterOrange = Color.valueOf("f6e096");
}
@@ -1,6 +1,7 @@
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;
@@ -10,15 +11,11 @@ import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
public class BulletFx {
public static Color lightFlame = Color.valueOf("ffdd55");
public static Color darkFlame = Color.valueOf("db401c");
public static Color lightOrange = Color.valueOf("f68021");
public static Color lighterOrange = Color.valueOf("f6e096");
public static final Effect
shootSmall = new Effect(8, e -> {
Draw.color(lighterOrange, lightOrange, e.ifract());
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);
@@ -26,7 +23,7 @@ public class BulletFx {
}),
shootSmallSmoke = new Effect(20f, e -> {
Draw.color(lighterOrange, Color.LIGHT_GRAY, Color.GRAY, e.ifract());
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);
@@ -35,8 +32,26 @@ public class BulletFx {
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(lightFlame, darkFlame, Color.GRAY, e.ifract());
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);
@@ -46,7 +61,7 @@ public class BulletFx {
}),
shellEjectSmall = new Effect(30f, e -> {
Draw.color(lightOrange, Color.LIGHT_GRAY, Color.GRAY, e.ifract());
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){
@@ -54,11 +69,32 @@ public class BulletFx {
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, lightOrange, e.ifract());
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) -> {
@@ -69,8 +105,20 @@ public class BulletFx {
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(lightFlame, darkFlame, e.ifract());
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) -> {
@@ -82,7 +130,7 @@ public class BulletFx {
}),
despawn = new Effect(12, e -> {
Draw.color(lighterOrange, Color.GRAY, e.ifract());
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) -> {