Basic fuse implementation

This commit is contained in:
Anuken
2018-08-28 13:10:49 -04:00
parent 1e25ba2d8e
commit 5416ad33bd
3 changed files with 36 additions and 2 deletions

View File

@@ -200,7 +200,10 @@ public class AmmoTypes implements ContentList{
meltdownLaser = new AmmoType(TurretBullets.lancerLaser);
fuseShotgun = new AmmoType(Items.copper, TurretBullets.fuseShot, 0.1f);
fuseShotgun = new AmmoType(Items.densealloy, TurretBullets.fuseShot, 1f){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
}};
//liquid

View File

@@ -216,6 +216,9 @@ public class TurretBlocks extends BlockList implements ContentList{
fuse = new ItemTurret("fuse"){{
//TODO make it use power
ammoTypes = new AmmoType[]{AmmoTypes.fuseShotgun};
reload = 50f;
shootShake = 4f;
range = 70f;
size = 3;
}};

View File

@@ -24,6 +24,7 @@ import io.anuke.ucore.core.Timers;
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;
@@ -159,7 +160,34 @@ public class TurretBullets extends BulletList implements ContentList{
}
};
fuseShot = new BulletType(0.01f, 100){
fuseShot = new BulletType(0.01f, 0){
int rays = 3;
float raySpace = 2f;
float rayLength = 70f;
{
hiteffect = BulletFx.hitBulletBig;
lifetime = 10f;
despawneffect = Fx.none;
pierce = true;
}
@Override
public void init(Bullet b) {
for (int i = 0; i < rays; i++) {
float offset = (i-rays/2)*raySpace;
vector.trns(b.angle(), 0.01f, offset);
Damage.collideLine(b, b.getTeam(), hiteffect, b.x, b.y, b.angle(), rayLength - Math.abs(i - (rays/2))*20f);
}
}
@Override
public void draw(Bullet b) {
super.draw(b);
Draw.color(Color.WHITE, Palette.surge, b.fin());
Shapes.tri(b.x, b.y, 12f, (rayLength+10) * b.fout(), b.angle());
Draw.reset();
}
//TODO
};