Fine, I'll do it myself (#5717)

This commit is contained in:
Anuken
2021-08-09 14:19:34 -04:00
parent 7e047ef726
commit 353433a383
3 changed files with 18 additions and 3 deletions

View File

@@ -24,6 +24,8 @@ public class MoveLightningAbility extends Ability{
public Color color = Color.valueOf("a9d8ff");
/** Shifts where the lightning spawns along the Y axis */
public float offset = 0f;
/** Offset along the X axis. */
public float width = 0f;
/** Jittering heat sprite like the shield on v5 Javelin */
public String heatRegion = "error";
/** Bullet type that is fired. Can be null */
@@ -33,6 +35,8 @@ public class MoveLightningAbility extends Ability{
public Effect shootEffect = Fx.sparkShoot;
public Sound shootSound = Sounds.spark;
protected float side = 1f;
MoveLightningAbility(){}
@@ -61,7 +65,7 @@ public class MoveLightningAbility extends Ability{
public void update(Unit unit){
float scl = Mathf.clamp((unit.vel().len() - minSpeed) / (maxSpeed - minSpeed));
if(Mathf.chance(Time.delta * chance * scl)){
float x = unit.x + Angles.trnsx(unit.rotation, offset, 0), y = unit.y + Angles.trnsy(unit.rotation, offset, 0);
float x = unit.x + Angles.trnsx(unit.rotation, offset, width * side), y = unit.y + Angles.trnsy(unit.rotation, offset, width * side);
shootEffect.at(x, y, unit.rotation, color);
shootSound.at(unit);
@@ -73,6 +77,8 @@ public class MoveLightningAbility extends Ability{
if(bullet != null){
bullet.create(unit, unit.team, x, y, unit.rotation + bulletAngle + Mathf.range(bulletSpread));
}
side *= -1f;
}
}