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
@@ -10,5 +10,7 @@ public class AmmoTypes {
basicSteel = new AmmoType(Items.steel, TurretBullets.basicSteel, 5, 0.8f),
basicFlame = new AmmoType(Liquids.oil, TurretBullets.basicFlame, 0.3f, 0.9f);
basicFlame = new AmmoType(Liquids.oil, TurretBullets.basicFlame, 0.3f, 0.9f),
basicLeadFrag = new AmmoType(Items.lead, TurretBullets.basicLeadFragShell, 1, 0.8f);
}
@@ -1,7 +1,7 @@
package io.anuke.mindustry.content;
import io.anuke.mindustry.content.bullets.TurretBullets;
import io.anuke.mindustry.graphics.fx.BulletFx;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.resource.Weapon;
public class Weapons {
@@ -3,7 +3,7 @@ package io.anuke.mindustry.content.blocks;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.graphics.fx.BlockFx;
import io.anuke.mindustry.content.fx.BlockFx;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.resource.ItemStack;
import io.anuke.mindustry.world.Block;
@@ -1,6 +1,6 @@
package io.anuke.mindustry.content.blocks;
import io.anuke.mindustry.graphics.fx.BlockFx;
import io.anuke.mindustry.content.fx.BlockFx;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.types.Wall;
import io.anuke.mindustry.world.blocks.types.defense.*;
@@ -1,6 +1,6 @@
package io.anuke.mindustry.content.blocks;
import io.anuke.mindustry.graphics.fx.BlockFx;
import io.anuke.mindustry.content.fx.BlockFx;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.types.defense.RepairTurret;
import io.anuke.mindustry.world.blocks.types.defense.ShieldBlock;
@@ -3,7 +3,7 @@ package io.anuke.mindustry.content.blocks;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.graphics.fx.BlockFx;
import io.anuke.mindustry.content.fx.BlockFx;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.types.production.Cultivator;
import io.anuke.mindustry.world.blocks.types.production.Drill;
@@ -1,12 +1,16 @@
package io.anuke.mindustry.content.blocks;
import io.anuke.mindustry.content.AmmoTypes;
import io.anuke.mindustry.graphics.fx.BulletFx;
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;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Strings;
public class WeaponBlocks{
public static Block
@@ -17,6 +21,7 @@ public class WeaponBlocks{
restitution = 0.03f;
shootEffect = BulletFx.shootSmall;
smokeEffect = BulletFx.shootSmallSmoke;
ammoUseEffect = BulletFx.shellEjectSmall;
}},
gatlingturret = new BurstTurret("gatlingturret") {{
@@ -39,6 +44,10 @@ public class WeaponBlocks{
shootCone = 50f;
shootEffect = BulletFx.shootSmallFlame;
ammoUseEffect = BulletFx.shellEjectSmall;
drawer = (tile, entity) -> {
Draw.rect(entity.target != null ? name + "-shoot" : name, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
};
}},
railgunturret = new ItemTurret("railgunturret"){{
@@ -51,20 +60,35 @@ public class WeaponBlocks{
shootShake = 2f;
shootEffect = BulletFx.shootBig;
smokeEffect = BulletFx.shootBigSmoke;
ammoUseEffect = BulletFx.shellEjectBig;
ammoUseEffect = BulletFx.shellEjectMedium;
}},
flakturret = new ItemTurret("flakturret"){{
size = 2;
range = 100f;
ammoTypes = new AmmoType[]{AmmoTypes.basicSteel};
reload = 100f;
ammoTypes = new AmmoType[]{AmmoTypes.basicLeadFrag};
reload = 70f;
restitution = 0.03f;
ammoEjectBack = 2f;
ammoEjectBack = 3f;
cooldown = 0.03f;
recoil = 3f;
shootShake = 2f;
shootEffect = BulletFx.shootBig;
smokeEffect = BulletFx.shootBigSmoke;
shootEffect = BulletFx.shootBig2;
smokeEffect = BulletFx.shootBigSmoke2;
ammoUseEffect = BulletFx.shellEjectBig;
drawer = (tile, entity) -> {
Draw.rect(name, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
float offsetx = (int)(Mathf.abscurve(Mathf.curve(entity.reload/reload, 0.3f, 0.2f)) * 3f);
float offsety = -(int)(Mathf.abscurve(Mathf.curve(entity.reload/reload, 0.3f, 0.2f)) * 2f);
for(int i : Mathf.signs){
float rot = entity.rotation + 90*i;
Draw.rect(name + "-panel-" + Strings.dir(i),
tile.drawx() + tr2.x + Angles.trnsx(rot, offsetx, offsety),
tile.drawy() + tr2.y + Angles.trnsy(rot, -offsetx, offsety), entity.rotation - 90);
}
};
}},
laserturret = new LaserTurret("laserturret"){
@@ -1,11 +1,14 @@
package io.anuke.mindustry.content.bullets;
import com.badlogic.gdx.graphics.Color;
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.graphics.Palette;
import io.anuke.mindustry.graphics.fx.BulletFx;
import io.anuke.mindustry.graphics.fx.Fx;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
public class TurretBullets {
@@ -14,9 +17,8 @@ public class TurretBullets {
basicIron = new BulletType(3f, 0) {
@Override
public void draw(Bullet b) {
Draw.color(Palette.bulletYellow);
Draw.rect("bullet", b.x, b.y, 9f, 5f + b.fract()*7f, b.angle() - 90);
Draw.color();
drawBullet(Palette.bulletYellow, Palette.bulletYellowBack,
"bullet", b.x, b.y, 9f, 5f + b.fract()*7f, b.angle() - 90);
}
},
@@ -28,9 +30,56 @@ public class TurretBullets {
@Override
public void draw(Bullet b) {
Draw.color(Palette.bulletYellow);
Draw.rect("bullet", b.x, b.y, 11f, 9f + b.fract()*8f, b.angle() - 90);
Draw.color();
drawBullet(Palette.bulletYellow, Palette.bulletYellowBack,
"bullet", b.x, b.y, 11f, 9f + b.fract()*8f, b.angle() - 90);
}
},
basicLeadFragShell = new BulletType(3f, 0) {
{
hiteffect = BulletFx.flakExplosion;
knockback = 0.8f;
lifetime = 90f;
drag = 0.01f;
}
@Override
public void draw(Bullet b) {
drawBullet(Palette.bulletYellow, Palette.bulletYellowBack,
"shell", b.x, b.y, 9f, 9f, b.angle() - 90);
}
@Override
public void hit(Bullet b, float x, float y) {
super.hit(b, x, y);
for(int i = 0; i < 9; i ++){
float len = Mathf.random(1f, 7f);
float a = Mathf.random(360f);
Bullet bullet = new Bullet(TurretBullets.basicLeadFrag, b,
x + Angles.trnsx(a, len), y + Angles.trnsy(a, len), a);
bullet.velocity.scl(Mathf.random(0.2f, 1f));
bullet.add();
}
}
@Override
public void despawned(Bullet b) {
hit(b);
}
},
basicLeadFrag = new BulletType(3f, 0) {
{
drag = 0.1f;
hiteffect = Fx.none;
despawneffect = Fx.none;
hitsize = 4;
}
@Override
public void draw(Bullet b) {
drawBullet(Palette.bulletYellow, Palette.bulletYellowBack,
"bullet", b.x, b.y, 10f, 1f + b.fract()*11f, b.angle() - 90);
}
},
@@ -47,4 +96,12 @@ public class TurretBullets {
@Override
public void draw(Bullet b) {}
};
private static void drawBullet(Color first, Color second, String name, float x, float y, float w, float h, float rot){
Draw.color(second);
Draw.rect(name + "-back", x, y, w, h, rot);
Draw.color(first);
Draw.rect(name, x, y, w, h, rot);
Draw.color();
}
}
@@ -0,0 +1,216 @@
package io.anuke.mindustry.content.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();
});
});
}
@@ -0,0 +1,216 @@
package io.anuke.mindustry.content.fx;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.entities.effect.StaticEffectEntity.StaticEffect;
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();
}),
shootBig2 = new Effect(10, e -> {
Draw.color(Palette.lightOrange, Color.GRAY, e.ifract());
float w = 1.2f + 8 * e.fract();
Shapes.tri(e.x, e.y, w, 29f * e.fract(), e.rotation);
Shapes.tri(e.x, e.y, w, 5f * 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();
}),
shootBigSmoke2 = new Effect(18f, e -> {
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Color.GRAY, e.ifract());
Angles.randLenVectors(e.id, 9, e.powfract()*23f, e.rotation, 20f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fract()*2.4f + 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 StaticEffect(30f, 300f, e -> {
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.ifract());
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) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.ifract()),
e.y + Angles.trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.ifract()),
1f, 2f, rot + e.ifract()*50f*i);
}
Draw.color();
}),
shellEjectMedium = new StaticEffect(34f, 300f, e -> {
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, 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("casing",
e.x + Angles.trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.ifract()),
e.y + Angles.trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.ifract()),
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();
}),
shellEjectBig = new StaticEffect(22f, 300f, e -> {
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.ifract());
float rot = e.rotation + 90f;
for(int i : Mathf.signs){
float len = (4f + e.powfract()*8f) * i;
float lr = rot + Mathf.randomSeedRange(e.id + i + 6, 20f * e.ifract())*i;
Draw.rect("casing",
e.x + Angles.trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.ifract()),
e.y + Angles.trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.ifract()),
2.5f, 4f,
rot+ e.ifract()*30f*i + Mathf.randomSeedRange(e.id + i + 9, 40f * e.ifract()));
}
Draw.color(Color.LIGHT_GRAY);
for(int i : Mathf.signs){
Angles.randLenVectors(e.id, 4, -e.powfract()*15f, e.rotation + 90f*i, 25f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fract()*2f);
});
}
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();
}),
flakExplosion = new Effect(20, e -> {
Draw.color(Palette.bulletYellow);
e.scaled(6, i -> {
Lines.stroke(3f * i.fract());
Lines.circle(e.x, e.y, 3f + i.ifract()*10f);
});
Draw.color(Color.GRAY);
Angles.randLenVectors(e.id, 5, 2f + 23f * e.powfract(), (x, y) ->{
Fill.circle(e.x + x, e.y + y, e.fract()*3f + 0.5f);
});
Draw.color(Palette.lighterOrange);
Lines.stroke(1f * e.fract());
Angles.randLenVectors(e.id + 1, 4, 1f + 23f * e.powfract(), (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), 1f + e.fract()*3f);
});
Draw.reset();
});
}
@@ -0,0 +1,60 @@
package io.anuke.mindustry.content.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.util.Angles;
import io.anuke.ucore.util.Mathf;
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(30, e -> {
e.scaled(7, i -> {
Lines.stroke(3f * i.fract());
Lines.circle(e.x, e.y, 3f + i.ifract()*10f);
});
Draw.color(Color.GRAY);
Angles.randLenVectors(e.id, 6, 2f + 19f * e.powfract(), (x, y) ->{
Fill.circle(e.x + x, e.y + y, e.fract()*3f + 0.5f);
Fill.circle(e.x + x/2f, e.y + y/2f, e.fract()*1f);
});
Draw.color(Palette.lighterOrange, Palette.lightOrange, Color.GRAY, e.ifract());
Lines.stroke(1.5f * e.fract());
Angles.randLenVectors(e.id + 1, 8, 1f + 23f * e.powfract(), (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), 1f + e.fract()*3f);
});
Draw.reset();
});
}
@@ -0,0 +1,61 @@
package io.anuke.mindustry.content.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();
});
}