Javelin abilities

This commit is contained in:
Anuken
2018-08-24 17:53:54 -04:00
parent 88ba8f6f55
commit 8c3f3ac304
11 changed files with 579 additions and 505 deletions

View File

@@ -255,14 +255,60 @@ public class Mechs implements ContentList{
trailColor = Palette.lightTrail;
}};
javelin = new Mech("javelin-ship", true){{
drillPower = -1;
speed = 0.4f;
maxSpeed = 3.6f;
drag = 0.09f;
weapon = Weapons.missiles;
trailColor = Color.valueOf("d3ddff");
}};
javelin = new Mech("javelin-ship", true){
float minV = 3.6f;
float maxV = 6f;
TextureRegion shield;
{
drillPower = -1;
speed = 0.11f;
maxSpeed = 3.4f;
drag = 0.01f;
weapon = Weapons.missiles;
trailColor = Color.valueOf("d3ddff");
}
@Override
public void load(){
super.load();
shield = Draw.region(name + "-shield");
}
@Override
public float getRotationAlpha(Player player){
return 0.5f;
}
@Override
public void updateAlt(Player player){
float scl = scld(player);
if(Mathf.chance(Timers.delta() * (0.15*scl))){
Effects.effect(BulletFx.hitLancer, Palette.lancerLaser, player.x, player.y);
Lightning.create(player.getTeam(), BulletFx.hitLancer, Palette.lancerLaser, 10f,
player.x + player.getVelocity().x, player.y + player.getVelocity().y, player.rotation, 14);
}
}
@Override
public void draw(Player player){
float scl = scld(player);
if(scl < 0.01f) return;
float alpha = Core.batch.getColor().a;
Graphics.shader();
Graphics.setAdditiveBlending();
Draw.color(Palette.lancerLaser);
Draw.alpha(scl/2f);
Draw.rect(shield, player.snappedX() + Mathf.range(scl/2f), player.snappedY() + Mathf.range(scl/2f), player.rotation - 90);
Graphics.setNormalBlending();
Graphics.shader(Shaders.mix);
Draw.color();
Draw.alpha(alpha);
}
float scld(Player player){
return Mathf.clamp((player.getVelocity().len() - minV) / (maxV - minV));
}
};
trident = new Mech("trident-ship", true){{
drillPower = 1;

View File

@@ -32,7 +32,7 @@ public class Weapons implements ContentList{
healBlaster = new Weapon("heal-blaster"){{
length = 1.5f;
reload = 30f;
reload = 24f;
roundrobin = false;
ejectEffect = Fx.none;
recoil = 2f;
@@ -41,12 +41,14 @@ public class Weapons implements ContentList{
missiles = new Weapon("missiles"){{
length = 1.5f;
reload = 40f;
shots = 2;
inaccuracy = 10f;
reload = 60f;
shots = 4;
inaccuracy = 2f;
roundrobin = false;
roundrobin = true;
ejectEffect = Fx.none;
velocityRnd = 0.2f;
spacing = 1f;
ammo = AmmoTypes.weaponMissile;
}};
@@ -55,6 +57,7 @@ public class Weapons implements ContentList{
recoil = 4f;
reload = 60f;
shots = 4;
spacing = 8f;
inaccuracy = 8f;
roundrobin = false;
roundrobin = true;

View File

@@ -2,10 +2,13 @@ package io.anuke.mindustry.content.bullets;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.entities.bullet.MissileBulletType;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.type.ContentList;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.util.Mathf;
public class MissileBullets extends BulletList implements ContentList{
public static BulletType explosive, incindiary, surge, javelin, swarm;
@@ -52,18 +55,27 @@ public class MissileBullets extends BulletList implements ContentList{
}
};
javelin = new MissileBulletType(2.5f, 14, "missile"){
javelin = new MissileBulletType(5f, 10.5f, "missile"){
{
bulletWidth = 8f;
bulletHeight = 8f;
bulletShrink = 0f;
drag = -0.02f;
drag = -0.003f;
keepVelocity = false;
splashDamageRadius = 25f;
splashDamage = 11f;
splashDamageRadius = 20f;
splashDamage = 3f;
lifetime = 90f;
trailColor = Color.valueOf("b6c6fd");
hiteffect = BulletFx.blastExplosion;
despawneffect = BulletFx.blastExplosion;
backColor = Palette.bulletYellowBack;
frontColor = Palette.bulletYellow;
}
@Override
public void update(Bullet b){
super.update(b);
b.getVelocity().rotate(Mathf.sin(Timers.time() + b.id * 4422, 8f, 2f));
}
};
@@ -84,6 +96,12 @@ public class MissileBullets extends BulletList implements ContentList{
hiteffect = BulletFx.blastExplosion;
despawneffect = BulletFx.blastExplosion;
}
@Override
public void update(Bullet b){
super.update(b);
b.getVelocity().rotate(Mathf.sin(Timers.time() + b.id * 4422, 8f, 2f));
}
};
}
}

View File

@@ -36,7 +36,7 @@ public class TurretBullets extends BulletList implements ContentList{
public void load(){
healBullet = new BulletType(5.2f, 19){
float healAmount = 20f;
float healAmount = 21f;
{
hiteffect = BulletFx.hitLaser;

View File

@@ -360,9 +360,9 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
if(mech.flying || boostHeat > 0.001f){
float wobblyness = 0.6f;
trail.update(x + Angles.trnsx(rotation + 180f, 5f) + Mathf.range(wobblyness),
if(!state.isPaused()) trail.update(x + Angles.trnsx(rotation + 180f, 5f) + Mathf.range(wobblyness),
y + Angles.trnsy(rotation + 180f, 5f) + Mathf.range(wobblyness));
trail.draw(Hue.mix(mech.trailColor, mech.trailColorTo, boostHeat, Tmp.c1), 5f * (isFlying() ? 1f : boostHeat));
trail.draw(Hue.mix(mech.trailColor, mech.trailColorTo, mech.flying ? 0f : boostHeat, Tmp.c1), 5f * (isFlying() ? 1f : boostHeat));
}else{
trail.clear();
}
@@ -587,7 +587,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
float baseLerp = mech.getRotationAlpha(this);
if(!isShooting()){
if(!movement.isZero()){
rotation = Mathf.slerpDelta(rotation, movement.angle(), 0.13f * baseLerp);
rotation = Mathf.slerpDelta(rotation, mech.flying ? velocity.angle() : movement.angle(), 0.13f * baseLerp);
}
}else{
float angle = control.input(playerIndex).mouseAngle(x, y);

View File

@@ -36,7 +36,7 @@ public class BasicBulletType extends BulletType{
public float incendChance = 1f;
public float homingPower = 0f;
public float homingRange = 40f;
public float homingRange = 50f;
public TextureRegion backRegion;
public TextureRegion frontRegion;

View File

@@ -14,7 +14,7 @@ public class MissileBulletType extends BasicBulletType{
super(speed, damage, bulletSprite);
backColor = Palette.missileYellowBack;
frontColor = Palette.missileYellow;
homingPower = 6f;
homingPower = 7f;
}
@Override

View File

@@ -149,7 +149,7 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait{
Draw.color(color, Color.WHITE, fin());
for(int i = 0; i < lines.size; i++){
Vector2 v = lines.get(i);
Lines.stroke(fout() * 3f + 1f - (float) i / lines.size);
Lines.stroke(fout() * 3f * (1.5f - (float) i / lines.size));
Lines.line(lx, ly, v.x, v.y);
lx = v.x;
ly = v.y;