Implemented lancer turret

This commit is contained in:
Anuken
2018-04-05 17:29:49 -04:00
parent 62608bea6c
commit ddf39461fb
12 changed files with 457 additions and 376 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 102 KiB

View File

@@ -1,7 +1,7 @@
#Autogenerated file. Do not modify. #Autogenerated file. Do not modify.
#Wed Apr 04 23:49:24 EDT 2018 #Thu Apr 05 17:29:03 EDT 2018
version=release version=release
androidBuildCode=845 androidBuildCode=846
name=Mindustry name=Mindustry
code=3.4 code=3.4
build=custom build build=custom build

View File

@@ -1,5 +1,6 @@
package io.anuke.mindustry.content.blocks; package io.anuke.mindustry.content.blocks;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.content.AmmoTypes; import io.anuke.mindustry.content.AmmoTypes;
import io.anuke.mindustry.content.fx.BulletFx; import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.resource.AmmoType; import io.anuke.mindustry.resource.AmmoType;
@@ -90,13 +91,20 @@ public class WeaponBlocks{
}; };
}}, }},
laserturret = new PowerTurret("laserturret"){{ laserturret = new LaserTurret("laserturret"){{
range = 70f; range = 70f;
chargeTime = 70f;
chargeMaxDelay = 30f;
chargeEffects = 7;
shootType = AmmoTypes.lancerLaser; shootType = AmmoTypes.lancerLaser;
recoil = 2f; recoil = 2f;
reload = 80f; reload = 130f;
cooldown = 0.03f;
shootEffect = BulletFx.lancerLaserShoot; shootEffect = BulletFx.lancerLaserShoot;
smokeEffect = BulletFx.lancerLaserShootSmoke; smokeEffect = BulletFx.lancerLaserShootSmoke;
chargeEffect = BulletFx.lancerLaserCharge;
chargeBeginEffect = BulletFx.lancerLaserChargeBegin;
heatColor = Color.RED;
}}, }},
teslaturret = new PowerTurret("teslaturret"){ teslaturret = new PowerTurret("teslaturret"){

View File

@@ -110,7 +110,7 @@ public class TurretBullets {
hiteffect = BulletFx.hitLancer; hiteffect = BulletFx.hitLancer;
despawneffect = Fx.none; despawneffect = Fx.none;
hitsize = 4; hitsize = 4;
lifetime = 12f; lifetime = 20f;
pierce = true; pierce = true;
} }

View File

@@ -14,202 +14,202 @@ public class BlockFx {
public static final Effect public static final Effect
reactorsmoke = new Effect(17, e -> { reactorsmoke = new Effect(17, e -> {
Angles.randLenVectors(e.id, 4, e.ifract()*8f, (x, y)->{ Angles.randLenVectors(e.id, 4, e.fin()*8f, (x, y)->{
float size = 1f+e.fract()*5f; float size = 1f+e.fout()*5f;
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.ifract()); Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.fin());
Draw.rect("circle", e.x + x, e.y + y, size, size); Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset(); Draw.reset();
}); });
}), }),
nuclearsmoke = new Effect(40, e -> { nuclearsmoke = new Effect(40, e -> {
Angles.randLenVectors(e.id, 4, e.ifract()*13f, (x, y)->{ Angles.randLenVectors(e.id, 4, e.fin()*13f, (x, y)->{
float size = e.sfract()*4f; float size = e.fslope()*4f;
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.ifract()); Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.fin());
Draw.rect("circle", e.x + x, e.y + y, size, size); Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset(); Draw.reset();
}); });
}), }),
nuclearcloud = new Effect(90, 200f, e -> { nuclearcloud = new Effect(90, 200f, e -> {
Angles.randLenVectors(e.id, 10, e.powfract()*90f, (x, y)->{ Angles.randLenVectors(e.id, 10, e.finpow()*90f, (x, y)->{
float size = e.fract()*14f; float size = e.fout()*14f;
Draw.color(Color.LIME, Color.GRAY, e.ifract()); Draw.color(Color.LIME, Color.GRAY, e.fin());
Draw.rect("circle", e.x + x, e.y + y, size, size); Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset(); Draw.reset();
}); });
}), }),
redgeneratespark = new Effect(18, e -> { redgeneratespark = new Effect(18, e -> {
Angles.randLenVectors(e.id, 5, e.ifract()*8f, (x, y)->{ Angles.randLenVectors(e.id, 5, e.fin()*8f, (x, y)->{
float len = e.fract()*4f; float len = e.fout()*4f;
Draw.color(Color.valueOf("fbb97f"), Color.GRAY, e.ifract()); Draw.color(Color.valueOf("fbb97f"), Color.GRAY, e.fin());
//Draw.alpha(e.fract()); //Draw.alpha(e.fout());
Draw.rect("circle", e.x + x, e.y + y, len, len); Draw.rect("circle", e.x + x, e.y + y, len, len);
Draw.reset(); Draw.reset();
}); });
}), }),
generatespark = new Effect(18, e -> { generatespark = new Effect(18, e -> {
Angles.randLenVectors(e.id, 5, e.ifract()*8f, (x, y)->{ Angles.randLenVectors(e.id, 5, e.fin()*8f, (x, y)->{
float len = e.fract()*4f; float len = e.fout()*4f;
Draw.color(Color.valueOf("d2b29c"), Color.GRAY, e.ifract()); Draw.color(Color.valueOf("d2b29c"), Color.GRAY, e.fin());
Draw.rect("circle", e.x + x, e.y + y, len, len); Draw.rect("circle", e.x + x, e.y + y, len, len);
Draw.reset(); Draw.reset();
}); });
}), }),
fuelburn = new Effect(23, e -> { fuelburn = new Effect(23, e -> {
Angles.randLenVectors(e.id, 5, e.ifract()*9f, (x, y)->{ Angles.randLenVectors(e.id, 5, e.fin()*9f, (x, y)->{
float len = e.fract()*4f; float len = e.fout()*4f;
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.ifract()); Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.fin());
Draw.rect("circle", e.x + x, e.y + y, len, len); Draw.rect("circle", e.x + x, e.y + y, len, len);
Draw.reset(); Draw.reset();
}); });
}), }),
plasticburn = new Effect(40, e -> { plasticburn = new Effect(40, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.ifract()*5f, (x, y)->{ Angles.randLenVectors(e.id, 5, 3f + e.fin()*5f, (x, y)->{
Draw.color(Color.valueOf("e9ead3"), Color.GRAY, e.ifract()); Draw.color(Color.valueOf("e9ead3"), Color.GRAY, e.fin());
Fill.circle(e.x + x, e.y + y, e.fract()*1f); Fill.circle(e.x + x, e.y + y, e.fout()*1f);
Draw.reset(); Draw.reset();
}); });
}), }),
pulverize = new Effect(40, e -> { pulverize = new Effect(40, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.ifract()*8f, (x, y)->{ Angles.randLenVectors(e.id, 5, 3f + e.fin()*8f, (x, y)->{
Draw.color(Fx.stoneGray); Draw.color(Fx.stoneGray);
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2f + 0.5f, 45); Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2f + 0.5f, 45);
Draw.reset(); Draw.reset();
}); });
}), }),
pulverizeRed = new Effect(40, e -> { pulverizeRed = new Effect(40, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.ifract()*8f, (x, y)->{ Angles.randLenVectors(e.id, 5, 3f + e.fin()*8f, (x, y)->{
Draw.color(Color.valueOf("ffa480"), Fx.stoneGray, e.ifract()); Draw.color(Color.valueOf("ffa480"), Fx.stoneGray, e.fin());
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2f + 0.5f, 45); Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2f + 0.5f, 45);
Draw.reset(); Draw.reset();
}); });
}), }),
pulverizeRedder = new Effect(40, e -> { pulverizeRedder = new Effect(40, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.ifract()*9f, (x, y)->{ Angles.randLenVectors(e.id, 5, 3f + e.fin()*9f, (x, y)->{
Draw.color(Color.valueOf("ff7b69"), Fx.stoneGray, e.ifract()); Draw.color(Color.valueOf("ff7b69"), Fx.stoneGray, e.fin());
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2.5f + 0.5f, 45); Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2.5f + 0.5f, 45);
Draw.reset(); Draw.reset();
}); });
}), }),
pulverizeSmall = new Effect(30, e -> { pulverizeSmall = new Effect(30, e -> {
Angles.randLenVectors(e.id, 3, e.ifract()*5f, (x, y)->{ Angles.randLenVectors(e.id, 3, e.fin()*5f, (x, y)->{
Draw.color(Fx.stoneGray); Draw.color(Fx.stoneGray);
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 1f + 0.5f, 45); Fill.poly(e.x + x, e.y + y, 4, e.fout() * 1f + 0.5f, 45);
Draw.reset(); Draw.reset();
}); });
}), }),
pulverizeMedium = new Effect(30, e -> { pulverizeMedium = new Effect(30, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.ifract()*8f, (x, y)->{ Angles.randLenVectors(e.id, 5, 3f + e.fin()*8f, (x, y)->{
Draw.color(Fx.stoneGray); Draw.color(Fx.stoneGray);
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 1f + 0.5f, 45); Fill.poly(e.x + x, e.y + y, 4, e.fout() * 1f + 0.5f, 45);
Draw.reset(); Draw.reset();
}); });
}), }),
producesmoke = new Effect(12, e -> { producesmoke = new Effect(12, e -> {
Angles.randLenVectors(e.id, 8, 4f + e.ifract()*18f, (x, y)->{ Angles.randLenVectors(e.id, 8, 4f + e.fin()*18f, (x, y)->{
Draw.color(Color.WHITE, Colors.get("accent"), e.ifract()); Draw.color(Color.WHITE, Colors.get("accent"), e.fin());
Fill.poly(e.x + x, e.y + y, 4, 1f+e.fract()*3f, 45); Fill.poly(e.x + x, e.y + y, 4, 1f+e.fout()*3f, 45);
Draw.reset(); Draw.reset();
}); });
}), }),
smeltsmoke = new Effect(15, e -> { smeltsmoke = new Effect(15, e -> {
Angles.randLenVectors(e.id, 6, 4f + e.ifract()*5f, (x, y)->{ Angles.randLenVectors(e.id, 6, 4f + e.fin()*5f, (x, y)->{
Draw.color(Color.WHITE, e.color, e.ifract()); Draw.color(Color.WHITE, e.color, e.fin());
Fill.poly(e.x + x, e.y + y, 4, 0.5f+e.fract()*2f, 45); Fill.poly(e.x + x, e.y + y, 4, 0.5f+e.fout()*2f, 45);
Draw.reset(); Draw.reset();
}); });
}), }),
formsmoke = new Effect(40, e -> { formsmoke = new Effect(40, e -> {
Angles.randLenVectors(e.id, 6, 5f + e.ifract()*8f, (x, y)->{ Angles.randLenVectors(e.id, 6, 5f + e.fin()*8f, (x, y)->{
Draw.color(Color.valueOf("f1e479"), Color.LIGHT_GRAY, e.ifract()); Draw.color(Color.valueOf("f1e479"), Color.LIGHT_GRAY, e.fin());
Fill.poly(e.x + x, e.y + y, 4, 0.2f+e.fract()*2f, 45); Fill.poly(e.x + x, e.y + y, 4, 0.2f+e.fout()*2f, 45);
Draw.reset(); Draw.reset();
}); });
}), }),
blastsmoke = new Effect(26, e -> { blastsmoke = new Effect(26, e -> {
Angles.randLenVectors(e.id, 12, 1f + e.ifract()*23f, (x, y)->{ Angles.randLenVectors(e.id, 12, 1f + e.fin()*23f, (x, y)->{
float size = 2f+e.fract()*6f; float size = 2f+e.fout()*6f;
Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.ifract()); Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.fin());
Draw.rect("circle", e.x + x, e.y + y, size, size); Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset(); Draw.reset();
}); });
}), }),
lava = new Effect(18, e -> { lava = new Effect(18, e -> {
Angles.randLenVectors(e.id, 3, 1f + e.ifract()*10f, (x, y)->{ Angles.randLenVectors(e.id, 3, 1f + e.fin()*10f, (x, y)->{
float size = e.sfract()*4f; float size = e.fslope()*4f;
Draw.color(Color.ORANGE, Color.GRAY, e.ifract()); Draw.color(Color.ORANGE, Color.GRAY, e.fin());
Draw.rect("circle", e.x + x, e.y + y, size, size); Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset(); Draw.reset();
}); });
}), }),
dooropen = new Effect(10, e -> { dooropen = new Effect(10, e -> {
Lines.stroke(e.fract() * 1.6f); Lines.stroke(e.fout() * 1.6f);
Lines.square(e.x, e.y, tilesize / 2f + e.ifract() * 2f); Lines.square(e.x, e.y, tilesize / 2f + e.fin() * 2f);
Draw.reset(); Draw.reset();
}), }),
doorclose= new Effect(10, e -> { doorclose= new Effect(10, e -> {
Lines.stroke(e.fract() * 1.6f); Lines.stroke(e.fout() * 1.6f);
Lines.square(e.x, e.y, tilesize / 2f + e.fract() * 2f); Lines.square(e.x, e.y, tilesize / 2f + e.fout() * 2f);
Draw.reset(); Draw.reset();
}), }),
dooropenlarge = new Effect(10, e -> { dooropenlarge = new Effect(10, e -> {
Lines.stroke(e.fract() * 1.6f); Lines.stroke(e.fout() * 1.6f);
Lines.square(e.x, e.y, tilesize + e.ifract() * 2f); Lines.square(e.x, e.y, tilesize + e.fin() * 2f);
Draw.reset(); Draw.reset();
}), }),
doorcloselarge = new Effect(10, e -> { doorcloselarge = new Effect(10, e -> {
Lines.stroke(e.fract() * 1.6f); Lines.stroke(e.fout() * 1.6f);
Lines.square(e.x, e.y, tilesize + e.fract() * 2f); Lines.square(e.x, e.y, tilesize + e.fout() * 2f);
Draw.reset(); Draw.reset();
}), }),
purify = new Effect(10, e -> { purify = new Effect(10, e -> {
Draw.color(Color.ROYAL, Color.GRAY, e.ifract()); Draw.color(Color.ROYAL, Color.GRAY, e.fin());
Lines.stroke(2f); Lines.stroke(2f);
Lines.spikes(e.x, e.y, e.ifract() * 4f, 2, 6); Lines.spikes(e.x, e.y, e.fin() * 4f, 2, 6);
Draw.reset(); Draw.reset();
}), }),
purifyoil = new Effect(10, e -> { purifyoil = new Effect(10, e -> {
Draw.color(Color.BLACK, Color.GRAY, e.ifract()); Draw.color(Color.BLACK, Color.GRAY, e.fin());
Lines.stroke(2f); Lines.stroke(2f);
Lines.spikes(e.x, e.y, e.ifract() * 4f, 2, 6); Lines.spikes(e.x, e.y, e.fin() * 4f, 2, 6);
Draw.reset(); Draw.reset();
}), }),
purifystone = new Effect(10, e -> { purifystone = new Effect(10, e -> {
Draw.color(Color.ORANGE, Color.GRAY, e.ifract()); Draw.color(Color.ORANGE, Color.GRAY, e.fin());
Lines.stroke(2f); Lines.stroke(2f);
Lines.spikes(e.x, e.y, e.ifract() * 4f, 2, 6); Lines.spikes(e.x, e.y, e.fin() * 4f, 2, 6);
Draw.reset(); Draw.reset();
}), }),
generate = new Effect(11, e -> { generate = new Effect(11, e -> {
Draw.color(Color.ORANGE, Color.YELLOW, e.ifract()); Draw.color(Color.ORANGE, Color.YELLOW, e.fin());
Lines.stroke(1f); Lines.stroke(1f);
Lines.spikes(e.x, e.y, e.ifract() * 5f, 2, 8); Lines.spikes(e.x, e.y, e.fin() * 5f, 2, 8);
Draw.reset(); Draw.reset();
}), }),
mine = new Effect(20, e -> { mine = new Effect(20, e -> {
Angles.randLenVectors(e.id, 6, 3f + e.ifract()*6f, (x, y)->{ Angles.randLenVectors(e.id, 6, 3f + e.fin()*6f, (x, y)->{
Draw.color(e.color, Color.LIGHT_GRAY, e.ifract()); Draw.color(e.color, Color.LIGHT_GRAY, e.fin());
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2f, 45); Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2f, 45);
Draw.reset(); Draw.reset();
}); });
}), }),
mineBig = new Effect(30, e -> { mineBig = new Effect(30, e -> {
Angles.randLenVectors(e.id, 6, 4f + e.ifract()*8f, (x, y)->{ Angles.randLenVectors(e.id, 6, 4f + e.fin()*8f, (x, y)->{
Draw.color(e.color, Color.LIGHT_GRAY, e.ifract()); Draw.color(e.color, Color.LIGHT_GRAY, e.fin());
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2f + 0.2f, 45); Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2f + 0.2f, 45);
Draw.reset(); Draw.reset();
}); });
}), }),
mineHuge = new Effect(40, e -> { mineHuge = new Effect(40, e -> {
Angles.randLenVectors(e.id, 8, 5f + e.ifract()*10f, (x, y)->{ Angles.randLenVectors(e.id, 8, 5f + e.fin()*10f, (x, y)->{
Draw.color(e.color, Color.LIGHT_GRAY, e.ifract()); Draw.color(e.color, Color.LIGHT_GRAY, e.fin());
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2f + 0.5f, 45); Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2f + 0.5f, 45);
Draw.reset(); Draw.reset();
}); });
}), }),
smelt = new Effect(20, e -> { smelt = new Effect(20, e -> {
Angles.randLenVectors(e.id, 6, 2f + e.ifract()*5f, (x, y)->{ Angles.randLenVectors(e.id, 6, 2f + e.fin()*5f, (x, y)->{
Draw.color(Color.WHITE, e.color, e.ifract()); Draw.color(Color.WHITE, e.color, e.fin());
Fill.poly(e.x + x, e.y + y, 4, 0.5f+e.fract()*2f, 45); Fill.poly(e.x + x, e.y + y, 4, 0.5f+e.fout()*2f, 45);
Draw.reset(); Draw.reset();
}); });
}); });

View File

@@ -16,102 +16,102 @@ public class BulletFx {
public static final Effect public static final Effect
shootSmall = new Effect(8, e -> { shootSmall = new Effect(8, e -> {
Draw.color(Palette.lighterOrange, Palette.lightOrange, e.ifract()); Draw.color(Palette.lighterOrange, Palette.lightOrange, e.fin());
float w = 1f + 5 * e.fract(); float w = 1f + 5 * e.fout();
Shapes.tri(e.x, e.y, w, 15f * e.fract(), e.rotation); Shapes.tri(e.x, e.y, w, 15f * e.fout(), e.rotation);
Shapes.tri(e.x, e.y, w, 3f * e.fract(), e.rotation + 180f); Shapes.tri(e.x, e.y, w, 3f * e.fout(), e.rotation + 180f);
Draw.reset(); Draw.reset();
}), }),
shootSmallSmoke = new Effect(20f, e -> { shootSmallSmoke = new Effect(20f, e -> {
Draw.color(Palette.lighterOrange, Color.LIGHT_GRAY, Color.GRAY, e.ifract()); Draw.color(Palette.lighterOrange, Color.LIGHT_GRAY, Color.GRAY, e.fin());
Angles.randLenVectors(e.id, 5, e.powfract()*6f, e.rotation, 20f, (x, y) -> { Angles.randLenVectors(e.id, 5, e.finpow()*6f, e.rotation, 20f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fract()*1.5f); Fill.circle(e.x + x, e.y + y, e.fout()*1.5f);
}); });
Draw.reset(); Draw.reset();
}), }),
shootBig = new Effect(9, e -> { shootBig = new Effect(9, e -> {
Draw.color(Palette.lighterOrange, Palette.lightOrange, e.ifract()); Draw.color(Palette.lighterOrange, Palette.lightOrange, e.fin());
float w = 1.2f + 7 * e.fract(); float w = 1.2f + 7 * e.fout();
Shapes.tri(e.x, e.y, w, 25f * e.fract(), e.rotation); Shapes.tri(e.x, e.y, w, 25f * e.fout(), e.rotation);
Shapes.tri(e.x, e.y, w, 4f * e.fract(), e.rotation + 180f); Shapes.tri(e.x, e.y, w, 4f * e.fout(), e.rotation + 180f);
Draw.reset(); Draw.reset();
}), }),
shootBig2 = new Effect(10, e -> { shootBig2 = new Effect(10, e -> {
Draw.color(Palette.lightOrange, Color.GRAY, e.ifract()); Draw.color(Palette.lightOrange, Color.GRAY, e.fin());
float w = 1.2f + 8 * e.fract(); float w = 1.2f + 8 * e.fout();
Shapes.tri(e.x, e.y, w, 29f * e.fract(), e.rotation); Shapes.tri(e.x, e.y, w, 29f * e.fout(), e.rotation);
Shapes.tri(e.x, e.y, w, 5f * e.fract(), e.rotation + 180f); Shapes.tri(e.x, e.y, w, 5f * e.fout(), e.rotation + 180f);
Draw.reset(); Draw.reset();
}), }),
shootBigSmoke = new Effect(17f, e -> { shootBigSmoke = new Effect(17f, e -> {
Draw.color(Palette.lighterOrange, Color.LIGHT_GRAY, Color.GRAY, e.ifract()); Draw.color(Palette.lighterOrange, Color.LIGHT_GRAY, Color.GRAY, e.fin());
Angles.randLenVectors(e.id, 8, e.powfract()*19f, e.rotation, 10f, (x, y) -> { Angles.randLenVectors(e.id, 8, e.finpow()*19f, e.rotation, 10f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fract()*2f + 0.2f); Fill.circle(e.x + x, e.y + y, e.fout()*2f + 0.2f);
}); });
Draw.reset(); Draw.reset();
}), }),
shootBigSmoke2 = new Effect(18f, e -> { shootBigSmoke2 = new Effect(18f, e -> {
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Color.GRAY, e.ifract()); Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Color.GRAY, e.fin());
Angles.randLenVectors(e.id, 9, e.powfract()*23f, e.rotation, 20f, (x, y) -> { Angles.randLenVectors(e.id, 9, e.finpow()*23f, e.rotation, 20f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fract()*2.4f + 0.2f); Fill.circle(e.x + x, e.y + y, e.fout()*2.4f + 0.2f);
}); });
Draw.reset(); Draw.reset();
}), }),
shootSmallFlame = new Effect(30f, e -> { shootSmallFlame = new Effect(30f, e -> {
Draw.color(Palette.lightFlame, Palette.darkFlame, Color.GRAY, e.ifract()); Draw.color(Palette.lightFlame, Palette.darkFlame, Color.GRAY, e.fin());
Angles.randLenVectors(e.id, 8, e.powfract()*26f, e.rotation, 10f, (x, y) -> { Angles.randLenVectors(e.id, 8, e.finpow()*26f, e.rotation, 10f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.65f + e.fract()*1.5f); Fill.circle(e.x + x, e.y + y, 0.65f + e.fout()*1.5f);
}); });
Draw.reset(); Draw.reset();
}), }),
shellEjectSmall = new StaticEffect(30f, 400f, e -> { shellEjectSmall = new StaticEffect(30f, 400f, e -> {
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.ifract()); Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.fin());
float rot = e.rotation + 90f; float rot = e.rotation + 90f;
for(int i : Mathf.signs){ for(int i : Mathf.signs){
float len = (2f + e.powfract()*6f) * i; float len = (2f + e.finpow()*6f) * i;
float lr = rot + e.ifract()*30f*i; float lr = rot + e.fin()*30f*i;
Draw.rect("white", Draw.rect("white",
e.x + Angles.trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.ifract()), e.x + Angles.trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()),
e.y + Angles.trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.ifract()), e.y + Angles.trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()),
1f, 2f, rot + e.ifract()*50f*i); 1f, 2f, rot + e.fin()*50f*i);
} }
Draw.color(); Draw.color();
}), }),
shellEjectMedium = new StaticEffect(34f, 400f, e -> { shellEjectMedium = new StaticEffect(34f, 400f, e -> {
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.ifract()); Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.fin());
float rot = e.rotation + 90f; float rot = e.rotation + 90f;
for(int i : Mathf.signs){ for(int i : Mathf.signs){
float len = (2f + e.powfract()*10f) * i; float len = (2f + e.finpow()*10f) * i;
float lr = rot + e.ifract()*20f*i; float lr = rot + e.fin()*20f*i;
Draw.rect("casing", Draw.rect("casing",
e.x + Angles.trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.ifract()), e.x + Angles.trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()),
e.y + Angles.trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.ifract()), e.y + Angles.trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()),
2f, 3f, rot); 2f, 3f, rot);
} }
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.ifract()); Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.fin());
for(int i : Mathf.signs){ for(int i : Mathf.signs){
Angles.randLenVectors(e.id, 4, 1f + e.powfract()*11f, e.rotation + 90f*i, 20f, (x, y) -> { Angles.randLenVectors(e.id, 4, 1f + e.finpow()*11f, e.rotation + 90f*i, 20f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fract()*1.5f); Fill.circle(e.x + x, e.y + y, e.fout()*1.5f);
}); });
} }
@@ -119,23 +119,23 @@ public class BulletFx {
}), }),
shellEjectBig = new StaticEffect(22f, 400f, e -> { shellEjectBig = new StaticEffect(22f, 400f, e -> {
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.ifract()); Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.fin());
float rot = e.rotation + 90f; float rot = e.rotation + 90f;
for(int i : Mathf.signs){ for(int i : Mathf.signs){
float len = (4f + e.powfract()*8f) * i; float len = (4f + e.finpow()*8f) * i;
float lr = rot + Mathf.randomSeedRange(e.id + i + 6, 20f * e.ifract())*i; float lr = rot + Mathf.randomSeedRange(e.id + i + 6, 20f * e.fin())*i;
Draw.rect("casing", Draw.rect("casing",
e.x + Angles.trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.ifract()), e.x + Angles.trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()),
e.y + Angles.trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.ifract()), e.y + Angles.trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()),
2.5f, 4f, 2.5f, 4f,
rot+ e.ifract()*30f*i + Mathf.randomSeedRange(e.id + i + 9, 40f * e.ifract())); rot+ e.fin()*30f*i + Mathf.randomSeedRange(e.id + i + 9, 40f * e.fin()));
} }
Draw.color(Color.LIGHT_GRAY); Draw.color(Color.LIGHT_GRAY);
for(int i : Mathf.signs){ for(int i : Mathf.signs){
Angles.randLenVectors(e.id, 4, -e.powfract()*15f, e.rotation + 90f*i, 25f, (x, y) -> { Angles.randLenVectors(e.id, 4, -e.finpow()*15f, e.rotation + 90f*i, 25f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fract()*2f); Fill.circle(e.x + x, e.y + y, e.fout()*2f);
}); });
} }
@@ -143,36 +143,36 @@ public class BulletFx {
}), }),
hitBulletSmall = new Effect(14, e -> { hitBulletSmall = new Effect(14, e -> {
Draw.color(Color.WHITE, Palette.lightOrange, e.ifract()); Draw.color(Color.WHITE, Palette.lightOrange, e.fin());
Lines.stroke(0.5f + e.fract()); Lines.stroke(0.5f + e.fout());
Angles.randLenVectors(e.id, 5, e.ifract()*15f, e.rotation, 50f, (x, y) -> { Angles.randLenVectors(e.id, 5, e.fin()*15f, e.rotation, 50f, (x, y) -> {
float ang = Mathf.atan2(x, y); float ang = Mathf.atan2(x, y);
Lines.lineAngle(e.x + x, e.y + y, ang, e.fract()*3 + 1f); Lines.lineAngle(e.x + x, e.y + y, ang, e.fout()*3 + 1f);
}); });
Draw.reset(); Draw.reset();
}), }),
hitBulletBig = new Effect(13, e -> { hitBulletBig = new Effect(13, e -> {
Draw.color(Color.WHITE, Palette.lightOrange, e.ifract()); Draw.color(Color.WHITE, Palette.lightOrange, e.fin());
Lines.stroke(0.5f + e.fract()*1.5f); Lines.stroke(0.5f + e.fout()*1.5f);
Angles.randLenVectors(e.id, 8, e.powfract()*30f, e.rotation, 50f, (x, y) -> { Angles.randLenVectors(e.id, 8, e.finpow()*30f, e.rotation, 50f, (x, y) -> {
float ang = Mathf.atan2(x, y); float ang = Mathf.atan2(x, y);
Lines.lineAngle(e.x + x, e.y + y, ang, e.fract()*4 + 1.5f); Lines.lineAngle(e.x + x, e.y + y, ang, e.fout()*4 + 1.5f);
}); });
Draw.reset(); Draw.reset();
}), }),
hitFlameSmall = new Effect(14, e -> { hitFlameSmall = new Effect(14, e -> {
Draw.color(Palette.lightFlame, Palette.darkFlame, e.ifract()); Draw.color(Palette.lightFlame, Palette.darkFlame, e.fin());
Lines.stroke(0.5f + e.fract()); Lines.stroke(0.5f + e.fout());
Angles.randLenVectors(e.id, 5, e.ifract()*15f, e.rotation, 50f, (x, y) -> { Angles.randLenVectors(e.id, 5, e.fin()*15f, e.rotation, 50f, (x, y) -> {
float ang = Mathf.atan2(x, y); float ang = Mathf.atan2(x, y);
Lines.lineAngle(e.x + x, e.y + y, ang, e.fract()*3 + 1f); Lines.lineAngle(e.x + x, e.y + y, ang, e.fout()*3 + 1f);
}); });
Draw.reset(); Draw.reset();
@@ -180,23 +180,23 @@ public class BulletFx {
hitLancer = new Effect(12, e -> { hitLancer = new Effect(12, e -> {
Draw.color(Color.WHITE); Draw.color(Color.WHITE);
Lines.stroke(e.fract()*1.5f); Lines.stroke(e.fout()*1.5f);
Angles.randLenVectors(e.id, 8, e.powfract()*17f, e.rotation, 360f, (x, y) -> { Angles.randLenVectors(e.id, 8, e.finpow()*17f, e.rotation, 360f, (x, y) -> {
float ang = Mathf.atan2(x, y); float ang = Mathf.atan2(x, y);
Lines.lineAngle(e.x + x, e.y + y, ang, e.fract()*4 + 1f); Lines.lineAngle(e.x + x, e.y + y, ang, e.fout()*4 + 1f);
}); });
Draw.reset(); Draw.reset();
}), }),
despawn = new Effect(12, e -> { despawn = new Effect(12, e -> {
Draw.color(Palette.lighterOrange, Color.GRAY, e.ifract()); Draw.color(Palette.lighterOrange, Color.GRAY, e.fin());
Lines.stroke(e.fract()); Lines.stroke(e.fout());
Angles.randLenVectors(e.id, 7, e.ifract()*7f, e.rotation, 40f, (x, y) -> { Angles.randLenVectors(e.id, 7, e.fin()*7f, e.rotation, 40f, (x, y) -> {
float ang = Mathf.atan2(x, y); float ang = Mathf.atan2(x, y);
Lines.lineAngle(e.x + x, e.y + y, ang, e.fract()*2 + 1f); Lines.lineAngle(e.x + x, e.y + y, ang, e.fout()*2 + 1f);
}); });
Draw.reset(); Draw.reset();
@@ -206,43 +206,61 @@ public class BulletFx {
Draw.color(Palette.bulletYellow); Draw.color(Palette.bulletYellow);
e.scaled(6, i -> { e.scaled(6, i -> {
Lines.stroke(3f * i.fract()); Lines.stroke(3f * i.fout());
Lines.circle(e.x, e.y, 3f + i.ifract()*10f); Lines.circle(e.x, e.y, 3f + i.fin()*10f);
}); });
Draw.color(Color.GRAY); Draw.color(Color.GRAY);
Angles.randLenVectors(e.id, 5, 2f + 23f * e.powfract(), (x, y) ->{ Angles.randLenVectors(e.id, 5, 2f + 23f * e.finpow(), (x, y) ->{
Fill.circle(e.x + x, e.y + y, e.fract()*3f + 0.5f); Fill.circle(e.x + x, e.y + y, e.fout()*3f + 0.5f);
}); });
Draw.color(Palette.lighterOrange); Draw.color(Palette.lighterOrange);
Lines.stroke(1f * e.fract()); Lines.stroke(1f * e.fout());
Angles.randLenVectors(e.id + 1, 4, 1f + 23f * e.powfract(), (x, y) -> { Angles.randLenVectors(e.id + 1, 4, 1f + 23f * e.finpow(), (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), 1f + e.fract()*3f); Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), 1f + e.fout()*3f);
}); });
Draw.reset(); Draw.reset();
}), }),
lancerLaserShoot = new Effect(12f, e -> { lancerLaserShoot = new Effect(21f, e -> {
Draw.color(Palette.lancerLaser); Draw.color(Palette.lancerLaser);
for(int i : Mathf.signs){ for(int i : Mathf.signs){
Shapes.tri(e.x, e.y, 4f * e.fract(), 29f, e.rotation + 90f*i); Shapes.tri(e.x, e.y, 4f * e.fout(), 29f, e.rotation + 90f*i);
} }
Draw.reset(); Draw.reset();
}), }),
lancerLaserShootSmoke = new Effect(20f, e -> { lancerLaserShootSmoke = new Effect(26f, e -> {
Draw.color(Palette.lancerLaser); Draw.color(Palette.lancerLaser);
Angles.randLenVectors(e.id, 7, 80f, e.rotation, 0f, (x, y) -> { Angles.randLenVectors(e.id, 7, 80f, e.rotation, 0f, (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), e.fract()*9f); Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), e.fout()*9f);
}); });
Draw.reset(); Draw.reset();
}),
lancerLaserCharge = new Effect(38f, e -> {
Draw.color(Palette.lancerLaser);
Angles.randLenVectors(e.id, 2, 1f + 20f * e.fout(), e.rotation, 120f, (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), e.fslope()*3f + 1f);
});
Draw.reset();
}),
lancerLaserChargeBegin = new Effect(71f, e -> {
Draw.color(Palette.lancerLaser);
Fill.circle(e.x, e.y, e.fin() * 3f);
Draw.color();
Fill.circle(e.x, e.y, e.fin() * 2f);
}); });
} }

View File

@@ -13,46 +13,46 @@ public class ExplosionFx {
public static final Effect public static final Effect
generatorexplosion = new Effect(28, 40f, e -> { generatorexplosion = new Effect(28, 40f, e -> {
Angles.randLenVectors(e.id, 16, 10f + e.ifract()*8f, (x, y) -> { Angles.randLenVectors(e.id, 16, 10f + e.fin()*8f, (x, y) -> {
float size = e.fract()*12f + 1f; float size = e.fout()*12f + 1f;
Draw.color(Color.WHITE, Color.PURPLE, e.ifract()); Draw.color(Color.WHITE, Color.PURPLE, e.fin());
Draw.rect("circle", e.x + x, e.y + y, size, size); Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset(); Draw.reset();
}); });
}), }),
shockwave = new Effect(10f, 80f, e -> { shockwave = new Effect(10f, 80f, e -> {
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract()); Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin());
Lines.stroke(e.fract()*2f + 0.2f); Lines.stroke(e.fout()*2f + 0.2f);
Lines.circle(e.x, e.y, e.ifract()*28f); Lines.circle(e.x, e.y, e.fin()*28f);
Draw.reset(); Draw.reset();
}), }),
nuclearShockwave = new Effect(10f, 200f, e -> { nuclearShockwave = new Effect(10f, 200f, e -> {
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.ifract()); Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin());
Lines.stroke(e.fract()*3f + 0.2f); Lines.stroke(e.fout()*3f + 0.2f);
Lines.poly(e.x, e.y, 40, e.ifract()*140f); Lines.poly(e.x, e.y, 40, e.fin()*140f);
Draw.reset(); Draw.reset();
}), }),
explosion = new Effect(30, e -> { explosion = new Effect(30, e -> {
e.scaled(7, i -> { e.scaled(7, i -> {
Lines.stroke(3f * i.fract()); Lines.stroke(3f * i.fout());
Lines.circle(e.x, e.y, 3f + i.ifract()*10f); Lines.circle(e.x, e.y, 3f + i.fin()*10f);
}); });
Draw.color(Color.GRAY); Draw.color(Color.GRAY);
Angles.randLenVectors(e.id, 6, 2f + 19f * e.powfract(), (x, y) ->{ Angles.randLenVectors(e.id, 6, 2f + 19f * e.finpow(), (x, y) ->{
Fill.circle(e.x + x, e.y + y, e.fract()*3f + 0.5f); Fill.circle(e.x + x, e.y + y, e.fout()*3f + 0.5f);
Fill.circle(e.x + x/2f, e.y + y/2f, e.fract()*1f); Fill.circle(e.x + x/2f, e.y + y/2f, e.fout()*1f);
}); });
Draw.color(Palette.lighterOrange, Palette.lightOrange, Color.GRAY, e.ifract()); Draw.color(Palette.lighterOrange, Palette.lightOrange, Color.GRAY, e.fin());
Lines.stroke(1.5f * e.fract()); Lines.stroke(1.5f * e.fout());
Angles.randLenVectors(e.id + 1, 8, 1f + 23f * e.powfract(), (x, y) -> { Angles.randLenVectors(e.id + 1, 8, 1f + 23f * e.finpow(), (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), 1f + e.fract()*3f); Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), 1f + e.fout()*3f);
}); });
Draw.reset(); Draw.reset();

View File

@@ -18,36 +18,36 @@ public class Fx{
none = new Effect(0, 0f, e->{}), none = new Effect(0, 0f, e->{}),
place = new Effect(16, e -> { place = new Effect(16, e -> {
Lines.stroke(3f - e.ifract() * 2f); Lines.stroke(3f - e.fin() * 2f);
Lines.square(e.x, e.y, tilesize / 2f + e.ifract() * 3f); Lines.square(e.x, e.y, tilesize / 2f + e.fin() * 3f);
Draw.reset(); Draw.reset();
}), }),
breakBlock = new Effect(12, e -> { breakBlock = new Effect(12, e -> {
Lines.stroke(2f); Lines.stroke(2f);
Draw.color(Color.WHITE, Colors.get("break"), e.ifract()); Draw.color(Color.WHITE, Colors.get("break"), e.fin());
Lines.spikes(e.x, e.y, e.ifract() * 6f, 2, 5, 90); Lines.spikes(e.x, e.y, e.fin() * 6f, 2, 5, 90);
Draw.reset(); Draw.reset();
}), }),
smoke = new Effect(100, e -> { smoke = new Effect(100, e -> {
Draw.color(Color.GRAY, new Color(0.3f, 0.3f, 0.3f, 1f), e.ifract()); Draw.color(Color.GRAY, new Color(0.3f, 0.3f, 0.3f, 1f), e.fin());
float size = 7f-e.ifract()*7f; float size = 7f-e.fin()*7f;
Draw.rect("circle", e.x, e.y, size, size); Draw.rect("circle", e.x, e.y, size, size);
Draw.reset(); Draw.reset();
}), }),
dash = new Effect(30, e -> { dash = new Effect(30, e -> {
Draw.color(Color.CORAL, Color.GRAY, e.ifract()); Draw.color(Color.CORAL, Color.GRAY, e.fin());
float size = e.fract()*4f; float size = e.fout()*4f;
Draw.rect("circle", e.x, e.y, size, size); Draw.rect("circle", e.x, e.y, size, size);
Draw.reset(); Draw.reset();
}), }),
spawn = new Effect(23, e -> { spawn = new Effect(23, e -> {
Lines.stroke(2f); Lines.stroke(2f);
Draw.color(Color.DARK_GRAY, Color.SCARLET, e.ifract()); Draw.color(Color.DARK_GRAY, Color.SCARLET, e.fin());
Lines.circle(e.x, e.y, 7f - e.ifract() * 6f); Lines.circle(e.x, e.y, 7f - e.fin() * 6f);
Draw.reset(); Draw.reset();
}), }),

View File

@@ -33,6 +33,12 @@ public abstract class Turret extends Block{
protected final int timerTarget = timers++; protected final int timerTarget = timers++;
protected Color heatColor = Palette.turretHeat;
protected Effect shootEffect = Fx.none;
protected Effect smokeEffect = Fx.none;
protected Effect ammoUseEffect = Fx.none;
protected String shootsound = "shoot";
protected int ammoPerShot = 1; protected int ammoPerShot = 1;
protected float ammoEjectBack = 1f; protected float ammoEjectBack = 1f;
protected float range = 50f; protected float range = 50f;
@@ -51,18 +57,12 @@ public abstract class Turret extends Block{
protected BiConsumer<Tile, TurretEntity> drawer = (tile, entity) -> Draw.rect(name, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90); protected BiConsumer<Tile, TurretEntity> drawer = (tile, entity) -> Draw.rect(name, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
protected BiConsumer<Tile, TurretEntity> heatDrawer = (tile, entity) ->{ protected BiConsumer<Tile, TurretEntity> heatDrawer = (tile, entity) ->{
Graphics.setAdditiveBlending(); Graphics.setAdditiveBlending();
Draw.color(Palette.turretHeat); Draw.color(heatColor);
Draw.alpha(entity.heat); Draw.alpha(entity.heat);
Draw.rect(name + "-heat", tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90); Draw.rect(name + "-heat", tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
Graphics.setNormalBlending(); Graphics.setNormalBlending();
}; };
protected Effect shootEffect = Fx.none;
protected Effect smokeEffect = Fx.none;
protected Effect ammoUseEffect = Fx.none;
protected String shootsound = "shoot";
public Turret(String name) { public Turret(String name) {
super(name); super(name);
update = true; update = true;

View File

@@ -0,0 +1,48 @@
package io.anuke.mindustry.world.blocks.types.defense.turrets;
import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.resource.AmmoType;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.util.Mathf;
import static io.anuke.mindustry.Vars.tilesize;
public class LaserTurret extends PowerTurret {
protected float chargeTime = 30f;
protected int chargeEffects = 5;
protected float chargeMaxDelay = 10f;
protected Effect chargeEffect = Fx.none;
protected Effect chargeBeginEffect = Fx.none;
public LaserTurret(String name) {
super(name);
}
@Override
public void shoot(Tile tile, AmmoType ammo){
TurretEntity entity = tile.entity();
useAmmo(tile);
tr.trns(entity.rotation, size * tilesize / 2);
Effects.effect(chargeBeginEffect, tile.drawx() + tr.x, tile.drawy() + tr.y, entity.rotation);
for(int i = 0; i < chargeEffects; i ++){
Timers.run(Mathf.random(chargeMaxDelay), () -> {
tr.trns(entity.rotation, size * tilesize / 2);
Effects.effect(chargeEffect, tile.drawx() + tr.x, tile.drawy() + tr.y, entity.rotation);
});
}
Timers.run(chargeTime, () -> {
entity.recoil = recoil;
entity.heat = 1f;
bullet(tile, ammo.bullet, entity.rotation + Mathf.range(inaccuracy));
effects(tile);
});
}
}