Changed to use new effects system
This commit is contained in:
@@ -56,6 +56,8 @@ public class Control extends Module{
|
||||
|
||||
UCore.log("Total blocks loaded: " + Block.getAllBlocks().size);
|
||||
|
||||
Draw.setCircleVertices(14);
|
||||
|
||||
Gdx.input.setCatchBackKey(true);
|
||||
|
||||
if(android){
|
||||
@@ -237,14 +239,15 @@ public class Control extends Module{
|
||||
|
||||
for(int i = 0; i < spawnamount; i ++){
|
||||
int index = i;
|
||||
float range = 8f;
|
||||
|
||||
Timers.run(index*50f, ()->{
|
||||
try{
|
||||
Constructor c = ClassReflection.getConstructor(spawn.type, int.class);
|
||||
Enemy enemy = (Enemy)c.newInstance(fl);
|
||||
enemy.set(tile.worldx(), tile.worldy());
|
||||
enemy.set(tile.worldx() + Mathf.range(range), tile.worldy() + Mathf.range(range));
|
||||
enemy.tier = spawn.tier(wave, fl);
|
||||
Effects.effect("spawn", enemy);
|
||||
Effects.effect(Fx.spawn, enemy);
|
||||
enemy.add();
|
||||
|
||||
enemies ++;
|
||||
@@ -294,10 +297,10 @@ public class Control extends Module{
|
||||
Tile core = World.core;
|
||||
for(int i = 0; i < 16; i ++){
|
||||
Timers.run(i*2, ()->{
|
||||
Effects.effect("explosion", core.worldx()+Mathf.range(40), core.worldy()+Mathf.range(40));
|
||||
Effects.effect(Fx.explosion, core.worldx()+Mathf.range(40), core.worldy()+Mathf.range(40));
|
||||
});
|
||||
}
|
||||
Effects.effect("coreexplosion", core.worldx(), core.worldy());
|
||||
Effects.effect(Fx.coreexplosion, core.worldx(), core.worldy());
|
||||
|
||||
Timers.run(60, ()->{
|
||||
ui.showRestart();
|
||||
@@ -393,8 +396,6 @@ public class Control extends Module{
|
||||
Entities.setCollider(tilesize, (x, y)->{
|
||||
return World.solid(x, y);
|
||||
});
|
||||
|
||||
EffectCreator.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -402,7 +403,8 @@ public class Control extends Module{
|
||||
|
||||
if(debug){
|
||||
if(Inputs.keyUp(Keys.P)){
|
||||
Effects.effect("blockexplosion", player);
|
||||
Effects.effect(Fx.shellsmoke, player);
|
||||
Effects.effect(Fx.shellexplosion, player);
|
||||
}
|
||||
|
||||
if(Inputs.keyUp(Keys.C)){
|
||||
|
||||
@@ -1,301 +0,0 @@
|
||||
package io.anuke.mindustry;
|
||||
|
||||
import static io.anuke.mindustry.Vars.respawnduration;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.graphics.Hue;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class EffectCreator{
|
||||
static Color lightRed = Hue.mix(Color.WHITE, Color.FIREBRICK, 0.1f);
|
||||
static Color lightOrange = Color.valueOf("f68021");
|
||||
|
||||
public static void create(){
|
||||
|
||||
Effects.create("generatorexplosion", 28, e -> {
|
||||
Angles.randLenVectors(e.id, 16, 10f + e.ifract()*8f, (x, y)->{
|
||||
float size = e.fract()*12f + 1f;
|
||||
Draw.color(Color.WHITE, lightOrange, e.ifract());
|
||||
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
||||
Draw.reset();
|
||||
});
|
||||
});
|
||||
|
||||
Effects.create("chainshot", 9f, e -> {
|
||||
Draw.color(Color.WHITE, lightOrange, e.ifract());
|
||||
Draw.thick(e.fract()*4f);
|
||||
Draw.lineAngle(e.x, e.y, e.rotation, e.fract()*7f);
|
||||
Draw.thick(e.fract()*2f);
|
||||
Draw.lineAngle(e.x, e.y, e.rotation, e.fract()*10f);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("shockwave", 10f, e -> {
|
||||
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract());
|
||||
Draw.thick(e.fract()*2f + 0.2f);
|
||||
Draw.circle(e.x, e.y, e.ifract()*28f);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("empshockwave", 7f, e -> {
|
||||
Draw.color(Color.WHITE, Color.SKY, e.ifract());
|
||||
Draw.thick(e.fract()*2f);
|
||||
Draw.circle(e.x, e.y, e.ifract()*40f);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("empspark", 13, e -> {
|
||||
Angles.randLenVectors(e.id, 7, 1f + e.ifract()*12f, (x, y)->{
|
||||
float len = 1f+e.fract()*6f;
|
||||
Draw.color(Color.SKY);
|
||||
Draw.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), len);
|
||||
Draw.reset();
|
||||
});
|
||||
});
|
||||
|
||||
Effects.create("shellsmoke", 21, e -> {
|
||||
Angles.randLenVectors(e.id, 8, 1f + e.ifract()*16f, (x, y)->{
|
||||
float size = 2f+e.fract()*5f;
|
||||
Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.ifract());
|
||||
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
||||
Draw.reset();
|
||||
});
|
||||
});
|
||||
|
||||
Effects.create("blastsmoke", 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();
|
||||
});
|
||||
});
|
||||
|
||||
Effects.create("lava", 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();
|
||||
});
|
||||
});
|
||||
|
||||
Effects.create("lavabubble", 45f, e -> {
|
||||
Draw.color(Color.ORANGE);
|
||||
float scl = 0.35f;
|
||||
Draw.thick(1f - Mathf.clamp(e.ifract() - (1f-scl)) * (1f/scl));
|
||||
Draw.circle(e.x, e.y, e.ifract()*4f);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("oilbubble", 64f, e -> {
|
||||
Draw.color(Color.DARK_GRAY);
|
||||
float scl = 0.25f;
|
||||
Draw.thick(1f - Mathf.clamp(e.ifract() - (1f-scl)) * (1f/scl));
|
||||
Draw.circle(e.x, e.y, e.ifract()*3f);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("shellexplosion", 15, e -> {
|
||||
Draw.thickness(1.3f - e.ifract());
|
||||
Draw.color(Color.WHITE, Color.ORANGE, e.ifract());
|
||||
Draw.circle(e.x, e.y, 1f + e.ifract() * 7f);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("blastexplosion", 16, e -> {
|
||||
Draw.thickness(1.2f - e.ifract());
|
||||
Draw.color(Color.WHITE, Color.SCARLET, e.ifract());
|
||||
Draw.circle(e.x, e.y, 1.5f + e.ifract() * 9f);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("place", 16, e -> {
|
||||
Draw.thickness(3f - e.ifract() * 2f);
|
||||
Draw.square(e.x, e.y, Vars.tilesize / 2f + e.ifract() * 3f);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("purify", 10, e -> {
|
||||
Draw.color(Color.ROYAL, Color.GRAY, e.ifract());
|
||||
Draw.thickness(2f);
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 4f, 2, 6);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("purifyoil", 10, e -> {
|
||||
Draw.color(Color.BLACK, Color.GRAY, e.ifract());
|
||||
Draw.thickness(2f);
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 4f, 2, 6);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("generate", 11, e -> {
|
||||
Draw.color(Color.ORANGE, Color.YELLOW, e.ifract());
|
||||
Draw.thickness(1f);
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 8);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("spark", 10, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Color.WHITE, Color.GRAY, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 8);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("sparkbig", 11, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(lightRed, Color.GRAY, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 5f, 2.3f, 8);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("smelt", 10, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Color.YELLOW, Color.RED, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 8);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("break", 12, e -> {
|
||||
Draw.thickness(2f);
|
||||
Draw.color(Color.WHITE, Color.GRAY, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 5);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("hit", 10, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Color.WHITE, Color.ORANGE, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 3f, 2, 8);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("laserhit", 10, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Color.WHITE, Color.SKY, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 2f, 2, 6);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("shoot", 8, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Color.WHITE, Color.GOLD, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 2f, 2, 5);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("shoot2", 8, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Color.WHITE, Color.SKY, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 2f, 1, 5);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("shoot3", 8, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Color.WHITE, Color.GOLD, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 2f, 1, 5);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("railshoot", 8, e -> {
|
||||
Draw.thickness(2f - e.ifract()*2f);
|
||||
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract());
|
||||
Draw.spikes(e.x, e.y, 1f + e.ifract() * 4f, 1, 5);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("mortarshoot", 9, e -> {
|
||||
Draw.thickness(1.3f - e.ifract());
|
||||
Draw.color(Color.WHITE, Color.ORANGE, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 4f, 2, 6);
|
||||
Draw.circle(e.x, e.y, e.ifract() * 5f + 1f);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("explosion", 11, e -> {
|
||||
Draw.thickness(2f*e.fract()+0.5f);
|
||||
Draw.color(Color.WHITE, Color.DARK_GRAY, e.powfract());
|
||||
Draw.circle(e.x, e.y, 5f + e.powfract() * 6f);
|
||||
|
||||
Draw.color(e.ifract() < 0.5f ? Color.WHITE : Color.DARK_GRAY);
|
||||
float rad = e.fract()*10f + 5f;
|
||||
Angles.randLenVectors(e.id, 5, 8f, (x, y)->{
|
||||
Draw.rect("circle2", e.x + x, e.y + y, rad, rad);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("blockexplosion", 13, e -> {
|
||||
Angles.randLenVectors(e.id+1, 8, 5f + e.ifract()*11f, (x, y)->{
|
||||
float size = 2f+e.fract()*8f;
|
||||
Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.ifract());
|
||||
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Draw.thickness(2f*e.fract()+0.4f);
|
||||
Draw.color(Color.WHITE, Color.ORANGE, e.powfract());
|
||||
Draw.circle(e.x, e.y, 2f + e.powfract() * 9f);
|
||||
|
||||
Draw.color(e.ifract() < 0.5f ? Color.WHITE : Color.DARK_GRAY);
|
||||
float rad = e.fract()*10f + 2f;
|
||||
Angles.randLenVectors(e.id, 5, 8f, (x, y)->{
|
||||
Draw.rect("circle2", e.x + x, e.y + y, rad, rad);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("coreexplosion", 13, e -> {
|
||||
Draw.thickness(3f-e.ifract()*2f);
|
||||
Draw.color(Color.ORANGE, Color.WHITE, e.ifract());
|
||||
Draw.spikes(e.x, e.y, 5f + e.ifract() * 40f, 6, 6);
|
||||
Draw.circle(e.x, e.y, 4f + e.ifract() * 40f);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("smoke", 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();
|
||||
});
|
||||
|
||||
Effects.create("railsmoke", 30, e -> {
|
||||
Draw.color(Color.LIGHT_GRAY, Color.WHITE, e.ifract());
|
||||
float size = e.fract()*4f;
|
||||
Draw.rect("circle", e.x, e.y, size, size);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("spawn", 23, e -> {
|
||||
Draw.thickness(2f);
|
||||
Draw.color(Color.DARK_GRAY, Color.SCARLET, e.ifract());
|
||||
Draw.circle(e.x, e.y, 7f - e.ifract() * 6f);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("ind", 100, e -> {
|
||||
Draw.thickness(3f);
|
||||
Draw.color("royal");
|
||||
Draw.circle(e.x, e.y, 3);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Effects.create("respawn", 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();
|
||||
});
|
||||
}
|
||||
}
|
||||
332
core/src/io/anuke/mindustry/Fx.java
Normal file
332
core/src/io/anuke/mindustry/Fx.java
Normal file
@@ -0,0 +1,332 @@
|
||||
package io.anuke.mindustry;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
import io.anuke.ucore.graphics.Hue;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class Fx{
|
||||
static Color lightRed = Hue.mix(Color.WHITE, Color.FIREBRICK, 0.1f);
|
||||
static Color lightOrange = Color.valueOf("f68021");
|
||||
static Color whiteOrange = Hue.mix(lightOrange, Color.WHITE, 0.6f);
|
||||
|
||||
public static final Effect
|
||||
|
||||
generatorexplosion = new Effect(28, e -> {
|
||||
Angles.randLenVectors(e.id, 16, 10f + e.ifract()*8f, (x, y)->{
|
||||
float size = e.fract()*12f + 1f;
|
||||
Draw.color(Color.WHITE, lightOrange, e.ifract());
|
||||
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
||||
Draw.reset();
|
||||
});
|
||||
}),
|
||||
|
||||
chainshot = new Effect(9f, e -> {
|
||||
Draw.color(Color.WHITE, lightOrange, e.ifract());
|
||||
Draw.thick(e.fract()*4f);
|
||||
Draw.lineAngle(e.x, e.y, e.rotation, e.fract()*7f);
|
||||
Draw.thick(e.fract()*2f);
|
||||
Draw.lineAngle(e.x, e.y, e.rotation, e.fract()*10f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
titanshot = new Effect(12f, e -> {
|
||||
Draw.color(Color.WHITE, lightOrange, e.ifract());
|
||||
Draw.thick(e.fract()*7f);
|
||||
Draw.lineAngle(e.x, e.y, e.rotation, e.fract()*12f);
|
||||
Draw.thick(e.fract()*4f);
|
||||
Draw.lineAngle(e.x, e.y, e.rotation, e.fract()*16f);
|
||||
Draw.thick(e.fract()*2f);
|
||||
Draw.lineAngle(e.x, e.y, e.rotation, e.fract()*18f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
shockwave = new Effect(10f, e -> {
|
||||
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract());
|
||||
Draw.thick(e.fract()*2f + 0.2f);
|
||||
Draw.circle(e.x, e.y, e.ifract()*28f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
shockwaveSmall = new Effect(10f, e -> {
|
||||
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract());
|
||||
Draw.thick(e.fract()*2f + 0.1f);
|
||||
Draw.circle(e.x, e.y, e.ifract()*15f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
empshockwave = new Effect(7f, e -> {
|
||||
Draw.color(Color.WHITE, Color.SKY, e.ifract());
|
||||
Draw.thick(e.fract()*2f);
|
||||
Draw.circle(e.x, e.y, e.ifract()*40f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
empspark = new Effect(13, e -> {
|
||||
Angles.randLenVectors(e.id, 7, 1f + e.ifract()*12f, (x, y)->{
|
||||
float len = 1f+e.fract()*6f;
|
||||
Draw.color(Color.SKY);
|
||||
Draw.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), len);
|
||||
Draw.reset();
|
||||
});
|
||||
}),
|
||||
|
||||
shellsmoke = new Effect(20, e -> {
|
||||
Angles.randLenVectors(e.id, 8, 3f + e.ifract()*17f, (x, y)->{
|
||||
float size = 2f+e.fract()*5f;
|
||||
Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.ifract());
|
||||
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
||||
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();
|
||||
});
|
||||
}),
|
||||
|
||||
lavabubble = new Effect(45f, e -> {
|
||||
Draw.color(Color.ORANGE);
|
||||
float scl = 0.35f;
|
||||
Draw.thick(1f - Mathf.clamp(e.ifract() - (1f-scl)) * (1f/scl));
|
||||
Draw.circle(e.x, e.y, e.ifract()*4f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
oilbubble = new Effect(64f, e -> {
|
||||
Draw.color(Color.DARK_GRAY);
|
||||
float scl = 0.25f;
|
||||
Draw.thick(1f - Mathf.clamp(e.ifract() - (1f-scl)) * (1f/scl));
|
||||
Draw.circle(e.x, e.y, e.ifract()*3f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
shellexplosion = new Effect(9, e -> {
|
||||
Draw.thickness(2f - e.ifract()*1.7f);
|
||||
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract());
|
||||
Draw.circle(e.x, e.y, 3f + e.ifract() * 9f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
blastexplosion = new Effect(16, e -> {
|
||||
Draw.thickness(1.2f - e.ifract());
|
||||
Draw.color(Color.WHITE, Color.SCARLET, e.ifract());
|
||||
Draw.circle(e.x, e.y, 1.5f + e.ifract() * 9f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
place = new Effect(16, e -> {
|
||||
Draw.thickness(3f - e.ifract() * 2f);
|
||||
Draw.square(e.x, e.y, Vars.tilesize / 2f + e.ifract() * 3f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
purify = new Effect(10, e -> {
|
||||
Draw.color(Color.ROYAL, Color.GRAY, e.ifract());
|
||||
Draw.thickness(2f);
|
||||
Draw.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());
|
||||
Draw.thickness(2f);
|
||||
Draw.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());
|
||||
Draw.thickness(1f);
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 8);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
spark = new Effect(10, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Color.WHITE, Color.GRAY, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 8);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
sparkbig = new Effect(11, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(lightRed, Color.GRAY, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 5f, 2.3f, 8);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
smelt = new Effect(10, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Color.YELLOW, Color.RED, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 8);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
breakBlock = new Effect(12, e -> {
|
||||
Draw.thickness(2f);
|
||||
Draw.color(Color.WHITE, Color.GRAY, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 5f, 2, 5);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
hit = new Effect(10, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Color.WHITE, Color.ORANGE, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 3f, 2, 8);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
laserhit = new Effect(10, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Color.WHITE, Color.SKY, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 2f, 2, 6);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
shoot = new Effect(8, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Color.WHITE, Color.GOLD, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 2f, 2, 5);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
shoot2 = new Effect(8, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Color.WHITE, Color.SKY, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 2f, 1, 5);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
shoot3 = new Effect(8, e -> {
|
||||
Draw.thickness(1f);
|
||||
Draw.color(Color.WHITE, Color.GOLD, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 2f, 1, 5);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
railshoot = new Effect(8, e -> {
|
||||
Draw.thickness(2f - e.ifract()*2f);
|
||||
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract());
|
||||
Draw.spikes(e.x, e.y, 1f + e.ifract() * 4f, 1, 5);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
mortarshoot = new Effect(9, e -> {
|
||||
Draw.thickness(1.3f - e.ifract());
|
||||
Draw.color(Color.WHITE, Color.ORANGE, e.ifract());
|
||||
Draw.spikes(e.x, e.y, e.ifract() * 4f, 2, 6);
|
||||
Draw.circle(e.x, e.y, e.ifract() * 5f + 1f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
titanExplosion = new Effect(11, e -> {
|
||||
Draw.thickness(2f*e.fract()+0.5f);
|
||||
Draw.color(Color.WHITE, Color.DARK_GRAY, e.powfract());
|
||||
Draw.circle(e.x, e.y, 5f + e.powfract() * 8f);
|
||||
|
||||
Draw.color(e.ifract() < 0.5f ? whiteOrange : Color.DARK_GRAY);
|
||||
float rad = e.fract()*10f + 5f;
|
||||
Angles.randLenVectors(e.id, 5, 9f, (x, y)->{
|
||||
Draw.rect("circle2", e.x + x, e.y + y, rad, rad);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
explosion = new Effect(11, e -> {
|
||||
Draw.thickness(2f*e.fract()+0.5f);
|
||||
Draw.color(Color.WHITE, Color.DARK_GRAY, e.powfract());
|
||||
Draw.circle(e.x, e.y, 5f + e.powfract() * 6f);
|
||||
|
||||
Draw.color(e.ifract() < 0.5f ? Color.WHITE : Color.DARK_GRAY);
|
||||
float rad = e.fract()*10f + 5f;
|
||||
Angles.randLenVectors(e.id, 5, 8f, (x, y)->{
|
||||
Draw.rect("circle2", e.x + x, e.y + y, rad, rad);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
|
||||
blockexplosion = new Effect(13, e -> {
|
||||
Angles.randLenVectors(e.id+1, 8, 5f + e.ifract()*11f, (x, y)->{
|
||||
float size = 2f+e.fract()*8f;
|
||||
Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.ifract());
|
||||
Draw.rect("circle", e.x + x, e.y + y, size, size);
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
Draw.thickness(2f*e.fract()+0.4f);
|
||||
Draw.color(Color.WHITE, Color.ORANGE, e.powfract());
|
||||
Draw.circle(e.x, e.y, 2f + e.powfract() * 9f);
|
||||
|
||||
Draw.color(e.ifract() < 0.5f ? Color.WHITE : Color.DARK_GRAY);
|
||||
float rad = e.fract()*10f + 2f;
|
||||
Angles.randLenVectors(e.id, 5, 8f, (x, y)->{
|
||||
Draw.rect("circle2", e.x + x, e.y + y, rad, rad);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
coreexplosion = new Effect(13, e -> {
|
||||
Draw.thickness(3f-e.ifract()*2f);
|
||||
Draw.color(Color.ORANGE, Color.WHITE, e.ifract());
|
||||
Draw.spikes(e.x, e.y, 5f + e.ifract() * 40f, 6, 6);
|
||||
Draw.circle(e.x, e.y, 4f + e.ifract() * 40f);
|
||||
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();
|
||||
}),
|
||||
|
||||
railsmoke = new Effect(30, e -> {
|
||||
Draw.color(Color.LIGHT_GRAY, Color.WHITE, e.ifract());
|
||||
float size = e.fract()*4f;
|
||||
Draw.rect("circle", e.x, e.y, size, size);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
spawn = new Effect(23, e -> {
|
||||
Draw.thickness(2f);
|
||||
Draw.color(Color.DARK_GRAY, Color.SCARLET, e.ifract());
|
||||
Draw.circle(e.x, e.y, 7f - e.ifract() * 6f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
ind = new Effect(100, e -> {
|
||||
Draw.thickness(3f);
|
||||
Draw.color("royal");
|
||||
Draw.circle(e.x, e.y, 3);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
respawn = new Effect(Vars.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();
|
||||
});
|
||||
}
|
||||
@@ -29,6 +29,10 @@ public class Vars{
|
||||
public static boolean debug = false;
|
||||
//whether to debug openGL info
|
||||
public static boolean debugGL = false;
|
||||
//whether turrets have infinite ammo (only with debug)
|
||||
public static boolean infiniteAmmo = true;
|
||||
//whether to show paths of enemies
|
||||
public static boolean showPaths = false;
|
||||
//number of save slots-- increasing may lead to layout issues
|
||||
//TODO named save slots, possibly with a scroll dialog
|
||||
public static final int saveSlots = 4;
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.badlogic.gdx.ai.pfa.indexed.IndexedAStarPathFinder;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
@@ -85,9 +86,9 @@ public class Pathfind{
|
||||
}
|
||||
|
||||
|
||||
if(Vars.debug)
|
||||
if(Vars.debug && Vars.showPaths)
|
||||
for(Tile tile : path){
|
||||
Effects.effect("ind", tile.worldx(), tile.worldy());
|
||||
Effects.effect(Fx.ind, tile.worldx(), tile.worldy());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@ package io.anuke.mindustry.entities;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.entities.effect.DamageArea;
|
||||
import io.anuke.mindustry.entities.effect.EMP;
|
||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
@@ -14,6 +17,9 @@ import io.anuke.ucore.util.Mathf;
|
||||
public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
static Color glowy = Color.valueOf("fdc056");
|
||||
static Color lightGold = Hue.mix(Color.GOLD, Color.WHITE, 0.4f);
|
||||
static Color lightRed = Hue.mix(Color.WHITE, Color.FIREBRICK, 0.1f);
|
||||
static Color lightOrange = Color.valueOf("f68021");
|
||||
static Color whiteOrange = Hue.mix(lightOrange, Color.WHITE, 0.6f);
|
||||
|
||||
public static final BulletType
|
||||
|
||||
@@ -36,8 +42,8 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
},
|
||||
chain = new BulletType(2f, 8){
|
||||
public void draw(Bullet b){
|
||||
Draw.color("gray");
|
||||
Draw.rect("bullet", b.x, b.y, b.angle());
|
||||
Draw.color(whiteOrange);
|
||||
Draw.rect("chainbullet", b.x, b.y, b.angle());
|
||||
Draw.reset();
|
||||
}
|
||||
},
|
||||
@@ -51,7 +57,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
|
||||
public void update(Bullet b){
|
||||
if(Timers.get(b, "smoke", 4)){
|
||||
Effects.effect("railsmoke", b.x, b.y);
|
||||
Effects.effect(Fx.railsmoke, b.x, b.y);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -72,7 +78,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
|
||||
public void update(Bullet b){
|
||||
if(Timers.get(b, "smoke", 2)){
|
||||
Effects.effect("empspark", b.x + Mathf.range(2), b.y + Mathf.range(2));
|
||||
Effects.effect(Fx.empspark, b.x + Mathf.range(2), b.y + Mathf.range(2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,19 +90,20 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
Timers.run(5f, ()->{
|
||||
new EMP(b.x, b.y, b.damage).add();
|
||||
});
|
||||
Effects.effect("empshockwave", b);
|
||||
Effects.effect(Fx.empshockwave, b);
|
||||
Effects.shake(3f, 3f, b);
|
||||
}
|
||||
},
|
||||
//TODO use DamageArea instead
|
||||
shell = new BulletType(1.1f, 85){
|
||||
//TODO better visuals for shell
|
||||
shell = new BulletType(1.1f, 60){
|
||||
{
|
||||
lifetime = 110f;
|
||||
hitsize = 8f;
|
||||
hitsize = 11f;
|
||||
}
|
||||
|
||||
public void draw(Bullet b){
|
||||
float rad = 8f;
|
||||
Draw.color(Color.ORANGE);
|
||||
Draw.color(Color.GRAY);
|
||||
Draw.rect("circle", b.x, b.y, rad, rad);
|
||||
rad += Mathf.sin(Timers.time(), 3f, 1f);
|
||||
@@ -107,7 +114,7 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
|
||||
public void update(Bullet b){
|
||||
if(Timers.get(b, "smoke", 7)){
|
||||
Effects.effect("smoke", b.x + Mathf.range(2), b.y + Mathf.range(2));
|
||||
Effects.effect(Fx.smoke, b.x + Mathf.range(2), b.y + Mathf.range(2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,13 +125,41 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
public void removed(Bullet b){
|
||||
Effects.shake(3f, 3f, b);
|
||||
|
||||
Effects.effect("shellsmoke", b);
|
||||
Effects.effect("shellexplosion", b);
|
||||
Effects.effect(Fx.shellsmoke, b);
|
||||
Effects.effect(Fx.shellexplosion, b);
|
||||
|
||||
Angles.circle(25, f->{
|
||||
Angles.translation(f, 5f);
|
||||
new Bullet(shellshot, b.owner, b.x + Angles.x(), b.y + Angles.y(), f).add();
|
||||
});
|
||||
DamageArea.damage(b.owner instanceof Enemy, b.x, b.y, 25f, (int)(damage * 2f/3f));
|
||||
}
|
||||
},
|
||||
titanshell = new BulletType(1.8f, 60){
|
||||
{
|
||||
lifetime = 70f;
|
||||
hitsize = 11f;
|
||||
}
|
||||
|
||||
public void draw(Bullet b){
|
||||
Draw.color(whiteOrange);
|
||||
Draw.rect("titanshell", b.x, b.y, b.angle());
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
public void update(Bullet b){
|
||||
if(Timers.get(b, "smoke", 4)){
|
||||
Effects.effect(Fx.smoke, b.x + Mathf.range(2), b.y + Mathf.range(2));
|
||||
}
|
||||
}
|
||||
|
||||
public void despawned(Bullet b){
|
||||
removed(b);
|
||||
}
|
||||
|
||||
public void removed(Bullet b){
|
||||
Effects.shake(3f, 3f, b);
|
||||
|
||||
Effects.effect(Fx.shellsmoke, b);
|
||||
Effects.effect(Fx.shockwaveSmall, b);
|
||||
|
||||
DamageArea.damage(!(b.owner instanceof Enemy), b.x, b.y, 25f, (int)(damage * 2f/3f));
|
||||
}
|
||||
},
|
||||
blast = new BulletType(1.1f, 80){
|
||||
@@ -141,8 +176,8 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
public void removed(Bullet b){
|
||||
Effects.shake(3f, 3f, b);
|
||||
|
||||
Effects.effect("blastsmoke", b);
|
||||
Effects.effect("blastexplosion", b);
|
||||
Effects.effect(Fx.blastsmoke, b);
|
||||
Effects.effect(Fx.blastexplosion, b);
|
||||
|
||||
Angles.circle(30, f->{
|
||||
Angles.translation(f, 6f);
|
||||
@@ -239,6 +274,6 @@ public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
|
||||
@Override
|
||||
public void removed(Bullet b){
|
||||
Effects.effect("hit", b);
|
||||
Effects.effect(Fx.hit, b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.badlogic.gdx.Input.Keys;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.resource.Recipe;
|
||||
import io.anuke.mindustry.resource.Weapon;
|
||||
@@ -35,7 +36,7 @@ public class Player extends DestructibleEntity{
|
||||
@Override
|
||||
public void onDeath(){
|
||||
remove();
|
||||
Effects.effect("explosion", this);
|
||||
Effects.effect(Fx.explosion, this);
|
||||
Effects.shake(4f, 5f, this);
|
||||
Effects.sound("die", this);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.io.IOException;
|
||||
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
@@ -89,7 +90,7 @@ public class TileEntity extends Entity{
|
||||
if(health != 0 && !(tile.block() instanceof Wall) &&
|
||||
Mathf.chance(0.009f*Timers.delta()*(1f-(float)health/maxhealth))){
|
||||
|
||||
Effects.effect("smoke", x+Mathf.range(4), y+Mathf.range(4));
|
||||
Effects.effect(Fx.smoke, x+Mathf.range(4), y+Mathf.range(4));
|
||||
}
|
||||
|
||||
tile.block().update(tile);
|
||||
|
||||
@@ -1,8 +1,47 @@
|
||||
package io.anuke.mindustry.entities.effect;
|
||||
|
||||
import io.anuke.ucore.entities.Entity;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.World;
|
||||
import io.anuke.ucore.entities.Entities;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
//TODO
|
||||
public class DamageArea extends Entity{
|
||||
|
||||
public class DamageArea{
|
||||
|
||||
public static void damage(boolean enemies, float x, float y, float radius, int damage){
|
||||
|
||||
if(enemies){
|
||||
Entities.getNearby(x, y, radius*2, entity->{
|
||||
if(entity instanceof Enemy){
|
||||
Enemy enemy = (Enemy)entity;
|
||||
if(enemy.distanceTo(x, y) > radius){
|
||||
return;
|
||||
}
|
||||
int amount = calculateDamage(x, y, enemy.x, enemy.y, radius, damage);
|
||||
enemy.damage(amount);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
int trad = (int)(radius / Vars.tilesize);
|
||||
for(int dx = -trad; dx <= trad; dx ++){
|
||||
for(int dy= -trad; dy <= trad; dy ++){
|
||||
Tile tile = World.tile(Mathf.scl2(x, Vars.tilesize) + dx, Mathf.scl2(y, Vars.tilesize) + dy);
|
||||
if(tile != null && tile.entity != null && Vector2.dst(dx, dy, 0, 0) <= trad){
|
||||
int amount = calculateDamage(x, y, tile.worldx(), tile.worldy(), radius, damage);
|
||||
tile.entity.damage(amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int calculateDamage(float x, float y, float tx, float ty, float radius, int damage){
|
||||
float dist = Vector2.dst(x, y, tx, ty);
|
||||
float scaled = 1f - dist/radius;
|
||||
return (int)(damage * scaled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.World;
|
||||
@@ -57,7 +58,7 @@ public class EMP extends TimedEntity{
|
||||
p.setPower(tile, 0f);
|
||||
}
|
||||
|
||||
Effects.effect("empspark", tile.entity);
|
||||
Effects.effect(Fx.empspark, tile.entity);
|
||||
tile.entity.damage(damage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.ObjectSet;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
@@ -64,7 +65,7 @@ public class TeslaOrb extends Entity{
|
||||
void damageEnemy(Enemy enemy){
|
||||
//TODO
|
||||
enemy.damage(damage);
|
||||
Effects.effect("laserhit", enemy.x + Mathf.range(2f), enemy.y + Mathf.range(2f));
|
||||
Effects.effect(Fx.laserhit, enemy.x + Mathf.range(2f), enemy.y + Mathf.range(2f));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.Shaders;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.ai.Pathfind;
|
||||
@@ -171,7 +172,7 @@ public class Enemy extends DestructibleEntity{
|
||||
|
||||
@Override
|
||||
public void onDeath(){
|
||||
Effects.effect("explosion", this);
|
||||
Effects.effect(Fx.explosion, this);
|
||||
Effects.shake(3f, 4f, this);
|
||||
Effects.sound("explosion", this);
|
||||
remove();
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.Bullet;
|
||||
import io.anuke.mindustry.entities.BulletType;
|
||||
@@ -22,7 +23,7 @@ public enum Weapon{
|
||||
@Override
|
||||
public void shoot(Player p){
|
||||
super.shoot(p);
|
||||
Effects.effect("shoot3", p.x + vector.x, p.y+vector.y);
|
||||
Effects.effect(Fx.shoot3, p.x + vector.x, p.y+vector.y);
|
||||
}
|
||||
},
|
||||
triblaster(13, BulletType.shot, "Shoots 3 bullets in a spread.", stack(Item.iron, 40)){
|
||||
@@ -36,7 +37,7 @@ public enum Weapon{
|
||||
bullet(p, p.x, p.y, ang+space);
|
||||
bullet(p, p.x, p.y, ang-space);
|
||||
|
||||
Effects.effect("shoot", p.x + vector.x, p.y+vector.y);
|
||||
Effects.effect(Fx.shoot, p.x + vector.x, p.y+vector.y);
|
||||
|
||||
}
|
||||
},
|
||||
@@ -48,7 +49,7 @@ public enum Weapon{
|
||||
|
||||
bullet(p, p.x, p.y, ang + Mathf.range(8));
|
||||
|
||||
Effects.effect("shoot2", p.x + vector.x, p.y+vector.y);
|
||||
Effects.effect(Fx.shoot, p.x + vector.x, p.y+vector.y);
|
||||
}
|
||||
},
|
||||
flamer(5, BulletType.flame, "Shoots a stream of fire.", stack(Item.steel, 60), stack(Item.coal, 60)){
|
||||
@@ -73,7 +74,7 @@ public enum Weapon{
|
||||
float ang = mouseAngle(p);
|
||||
|
||||
bullet(p, p.x, p.y, ang);
|
||||
Effects.effect("railshoot", p.x + vector.x, p.y+vector.y);
|
||||
Effects.effect(Fx.railshoot, p.x + vector.x, p.y+vector.y);
|
||||
}
|
||||
},
|
||||
mortar(100, BulletType.shell, "Shoots a slow, but damaging shell.", stack(Item.titanium, 40), stack(Item.steel, 60)){
|
||||
@@ -82,7 +83,7 @@ public enum Weapon{
|
||||
public void shoot(Player p){
|
||||
float ang = mouseAngle(p);
|
||||
bullet(p, p.x, p.y, ang);
|
||||
Effects.effect("mortarshoot", p.x + vector.x, p.y+vector.y);
|
||||
Effects.effect(Fx.mortarshoot, p.x + vector.x, p.y+vector.y);
|
||||
Effects.shake(2f, 2f, Vars.player);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.GameState;
|
||||
import io.anuke.mindustry.GameState.State;
|
||||
import io.anuke.mindustry.Vars;
|
||||
@@ -13,6 +14,7 @@ import io.anuke.mindustry.resource.ItemStack;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
import io.anuke.ucore.util.Tmp;
|
||||
public class Block{
|
||||
private static int lastid;
|
||||
@@ -26,7 +28,7 @@ public class Block{
|
||||
/**display name*/
|
||||
public String formalName;
|
||||
/**played on destroy*/
|
||||
public String explosionEffect = "blockexplosion";
|
||||
public Effect explosionEffect = Fx.blockexplosion;
|
||||
/**played on destroy*/
|
||||
public String explosionSound = "break";
|
||||
/**whether this block has a tile entity that updates*/
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.math.*;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.ai.Pathfind;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
@@ -222,11 +223,11 @@ public class World{
|
||||
toplace.setLinked((byte)(dx + offsetx), (byte)(dy + offsety));
|
||||
}
|
||||
|
||||
Effects.effect("place", worldx * Vars.tilesize, worldy * Vars.tilesize);
|
||||
Effects.effect(Fx.place, worldx * Vars.tilesize, worldy * Vars.tilesize);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
Effects.effect("place", x * Vars.tilesize, y * Vars.tilesize);
|
||||
Effects.effect(Fx.place, x * Vars.tilesize, y * Vars.tilesize);
|
||||
}
|
||||
|
||||
Effects.shake(2f, 2f, player);
|
||||
@@ -307,14 +308,14 @@ public class World{
|
||||
|
||||
if(!tile.block().isMultiblock() && !tile.isLinked()){
|
||||
tile.setBlock(Blocks.air);
|
||||
Effects.effect("break", tile.worldx(), tile.worldy());
|
||||
Effects.effect(Fx.breakBlock, tile.worldx(), tile.worldy());
|
||||
}else{
|
||||
Tile target = tile.isLinked() ? tile.getLinked() : tile;
|
||||
Array<Tile> removals = target.getLinkedTiles();
|
||||
for(Tile toremove : removals){
|
||||
//note that setting a new block automatically unlinks it
|
||||
toremove.setBlock(Blocks.air);
|
||||
Effects.effect("break", toremove.worldx(), toremove.worldy());
|
||||
Effects.effect(Fx.breakBlock, toremove.worldx(), toremove.worldy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.GameState;
|
||||
import io.anuke.mindustry.GameState.State;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
@@ -51,11 +52,11 @@ public class Blocks{
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
if(Mathf.chance(0.001 * Timers.delta())){
|
||||
Effects.effect("lava", tile.worldx() + Mathf.range(5f), tile.worldy() + Mathf.range(5f));
|
||||
Effects.effect(Fx.lava, tile.worldx() + Mathf.range(5f), tile.worldy() + Mathf.range(5f));
|
||||
}
|
||||
|
||||
if(Mathf.chance(0.003 * Timers.delta())){
|
||||
Effects.effect("lavabubble", tile.worldx() + Mathf.range(3f), tile.worldy() + Mathf.range(3f));
|
||||
Effects.effect(Fx.lavabubble, tile.worldx() + Mathf.range(3f), tile.worldy() + Mathf.range(3f));
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -70,7 +71,7 @@ public class Blocks{
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
if(Mathf.chance(0.0025 * Timers.delta())){
|
||||
Effects.effect("oilbubble", tile.worldx() + Mathf.range(2f), tile.worldy() + Mathf.range(2f));
|
||||
Effects.effect(Fx.oilbubble, tile.worldx() + Mathf.range(2f), tile.worldy() + Mathf.range(2f));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
@@ -113,7 +114,7 @@ public class ProductionBlocks{
|
||||
purifyTime = 70;
|
||||
output = Item.coal;
|
||||
health = 80;
|
||||
craftEffect = "purifyoil";
|
||||
craftEffect = Fx.purifyoil;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -164,7 +165,7 @@ public class ProductionBlocks{
|
||||
|
||||
if(tile.floor().drops != null && Timers.get(tile, "drill", 60 * time)){
|
||||
offloadNear(tile, tile.floor().drops.item);
|
||||
Effects.effect("sparkbig", tile.worldx(), tile.worldy());
|
||||
Effects.effect(Fx.sparkbig, tile.worldx(), tile.worldy());
|
||||
}
|
||||
|
||||
if(Timers.get(tile, "dump", 30)){
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.anuke.mindustry.world.blocks;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.BulletType;
|
||||
import io.anuke.mindustry.entities.effect.TeslaOrb;
|
||||
@@ -167,15 +168,49 @@ public class WeaponBlocks{
|
||||
|
||||
chainturret = new Turret("chainturret"){
|
||||
{
|
||||
inaccuracy = 7f;
|
||||
inaccuracy = 8f;
|
||||
formalName = "chain turret";
|
||||
range = 60f;
|
||||
reload = 10f;
|
||||
range = 80f;
|
||||
reload = 7f;
|
||||
bullet = BulletType.chain;
|
||||
ammo = Item.stone; //TODO
|
||||
ammo = Item.uranium;
|
||||
health = 430;
|
||||
ammoMultiplier = 10;
|
||||
width = height = 2;
|
||||
shootCone = 9f;
|
||||
}
|
||||
|
||||
//TODO specify turret shoot effect in turret instead of doing it manually
|
||||
@Override
|
||||
protected void shoot(Tile tile){
|
||||
TurretEntity entity = tile.entity();
|
||||
Vector2 offset = getPlaceOffset();
|
||||
|
||||
float len = 8;
|
||||
float space = 3.5f;
|
||||
|
||||
for(int i = -1; i < 1; i ++){
|
||||
Angles.vector.set(len, Mathf.sign(i) * space).rotate(entity.rotation);
|
||||
bullet(tile, entity.rotation);
|
||||
Effects.effect(Fx.chainshot, tile.worldx() + Angles.x() + offset.x,
|
||||
tile.worldy()+ Angles.y() + offset.y, entity.rotation);
|
||||
}
|
||||
|
||||
Effects.shake(1f, 1f, tile.worldx(), tile.worldy());
|
||||
}
|
||||
},
|
||||
|
||||
titanturret = new Turret("titancannon"){
|
||||
{
|
||||
formalName = "titan cannon";
|
||||
range = 120f;
|
||||
reload = 20f;
|
||||
bullet = BulletType.titanshell;
|
||||
ammo = Item.uranium;
|
||||
health = 800;
|
||||
ammoMultiplier = 5;
|
||||
width = height = 3;
|
||||
rotatespeed = 0.07f;
|
||||
shootCone = 9f;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -183,31 +218,12 @@ public class WeaponBlocks{
|
||||
TurretEntity entity = tile.entity();
|
||||
Vector2 offset = getPlaceOffset();
|
||||
|
||||
float len = 8;
|
||||
float space = 4f;
|
||||
Angles.translation(entity.rotation, 14f);
|
||||
bullet(tile, entity.rotation);
|
||||
Effects.effect(Fx.titanshot, tile.worldx() + Angles.x() + offset.x,
|
||||
tile.worldy()+ Angles.y() + offset.y, entity.rotation);
|
||||
|
||||
Angles.vector.set(len, -space).rotate(entity.rotation);
|
||||
bullet(tile, entity.rotation);
|
||||
Effects.effect("chainshot", tile.worldx() + Angles.x() + offset.x, tile.worldy()+ Angles.y() + offset.y, entity.rotation);
|
||||
|
||||
Angles.vector.set(len, space).rotate(entity.rotation);
|
||||
bullet(tile, entity.rotation);
|
||||
Effects.effect("chainshot", tile.worldx() + Angles.x() + offset.x, tile.worldy()+ Angles.y() + offset.y, entity.rotation);
|
||||
}
|
||||
},
|
||||
|
||||
titanturret = new Turret("titancannon"){
|
||||
{
|
||||
inaccuracy = 7f;
|
||||
formalName = "titan cannon";
|
||||
range = 120f;
|
||||
reload = 40f;
|
||||
bullet = BulletType.shell;
|
||||
ammo = Item.coal;
|
||||
health = 800;
|
||||
ammoMultiplier = 10;
|
||||
width = height = 3;
|
||||
rotatespeed = 0.08f;
|
||||
Effects.shake(3f, 3f, tile.worldx(), tile.worldy());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ package io.anuke.mindustry.world.blocks.types.defense;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.entities.enemies.Enemy;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
@@ -14,7 +16,7 @@ import io.anuke.ucore.util.Tmp;
|
||||
|
||||
public class LaserTurret extends PowerTurret{
|
||||
protected Color beamColor = Color.WHITE.cpy();
|
||||
protected String hiteffect = "laserhit";
|
||||
protected Effect hiteffect = Fx.laserhit;
|
||||
protected int damage = 4;
|
||||
protected float cone = 15f;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.io.IOException;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.Bullet;
|
||||
import io.anuke.mindustry.entities.BulletType;
|
||||
@@ -188,7 +189,7 @@ public class Turret extends Block{
|
||||
|
||||
if(Timers.getTime(tile, "reload") <= 0){
|
||||
Timers.run(hittime, ()->{
|
||||
Effects.effect("spawn", predictX, predictY);
|
||||
Effects.effect(Fx.spawn, predictX, predictY);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -206,7 +207,8 @@ public class Turret extends Block{
|
||||
}
|
||||
|
||||
protected void bullet(Tile tile, float angle){
|
||||
Bullet out = new Bullet(bullet, tile.entity, tile.worldx() + Angles.x(), tile.worldy() + Angles.y(), angle).add();
|
||||
Vector2 offset = getPlaceOffset();
|
||||
Bullet out = new Bullet(bullet, tile.entity, tile.worldx() + Angles.x() + offset.x, tile.worldy() + Angles.y() + offset.y, angle).add();
|
||||
out.damage = (int)(bullet.damage*Vars.multiplier);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks.types.production;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
@@ -34,7 +35,7 @@ public class Crafter extends Block{
|
||||
}
|
||||
|
||||
offloadNear(tile, result);
|
||||
Effects.effect("smelt", tile.entity);
|
||||
Effects.effect(Fx.smelt, tile.entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks.types.production;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
@@ -25,7 +26,7 @@ public class Drill extends Block{
|
||||
|
||||
if(tile.floor() == resource && Timers.get(tile, "drill", 60 * time) && tile.entity.totalItems() < capacity){
|
||||
offloadNear(tile, result);
|
||||
Effects.effect("spark", tile.worldx(), tile.worldy());
|
||||
Effects.effect(Fx.spark, tile.worldx(), tile.worldy());
|
||||
}
|
||||
|
||||
if(Timers.get(tile, "dump", 30)){
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.GridPoint2;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.World;
|
||||
@@ -35,13 +36,13 @@ public class Generator extends PowerBlock{
|
||||
if(explosive){
|
||||
float x = tile.worldx(), y = tile.worldy();
|
||||
|
||||
Effects.effect("shellsmoke", x, y);
|
||||
Effects.effect("blastsmoke", x, y);
|
||||
Effects.effect(Fx.shellsmoke, x, y);
|
||||
Effects.effect(Fx.blastsmoke, x, y);
|
||||
|
||||
Timers.run(Mathf.random(8f + Mathf.random(6f)), () -> {
|
||||
Effects.shake(6f, 8f, x, y);
|
||||
Effects.effect("generatorexplosion", x, y);
|
||||
Effects.effect("shockwave", x, y);
|
||||
Effects.effect(Fx.generatorexplosion, x, y);
|
||||
Effects.effect(Fx.shockwave, x, y);
|
||||
|
||||
Timers.run(12f + Mathf.random(20f), () -> {
|
||||
tile.damageNearby(3, 40, 0f);
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.world.blocks.types.production;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
@@ -37,7 +38,7 @@ public class ItemPowerGenerator extends Generator{
|
||||
PowerEntity entity = tile.entity();
|
||||
|
||||
if(entity.hasItem(generateItem) && tryAddPower(tile, generateAmount)){
|
||||
Effects.effect("generate", tile.entity);
|
||||
Effects.effect(Fx.generate, tile.entity);
|
||||
entity.removeItem(generateItem, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.world.blocks.types.production;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
@@ -10,6 +11,7 @@ import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.types.LiquidBlock;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
|
||||
public class LiquidCrafter extends LiquidBlock{
|
||||
@@ -21,7 +23,7 @@ public class LiquidCrafter extends LiquidBlock{
|
||||
public Item output = null;
|
||||
public int itemCapacity = 90;
|
||||
public int purifyTime = 80;
|
||||
public String craftEffect = "purify";
|
||||
public Effect craftEffect = Fx.purify;
|
||||
|
||||
public LiquidCrafter(String name) {
|
||||
super(name);
|
||||
|
||||
@@ -6,12 +6,14 @@ import java.io.IOException;
|
||||
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
import io.anuke.mindustry.Fx;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.types.LiquidAcceptor;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
|
||||
public class LiquidPowerGenerator extends Generator implements LiquidAcceptor{
|
||||
@@ -22,7 +24,7 @@ public class LiquidPowerGenerator extends Generator implements LiquidAcceptor{
|
||||
/**How much liquid to consume to get one generatePower.*/
|
||||
public float inputLiquid = 5f;
|
||||
public float liquidCapacity = 30f;
|
||||
public String generateEffect = "generate";
|
||||
public Effect generateEffect = Fx.generate;
|
||||
|
||||
public LiquidPowerGenerator(String name) {
|
||||
super(name);
|
||||
|
||||
@@ -2,6 +2,8 @@ package io.anuke.ucore.function;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
|
||||
public interface EffectProvider{
|
||||
public void createEffect(String name, Color color, float x, float y, float rotation);
|
||||
public void createEffect(Effect effect, Color color, float x, float y, float rotation);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user