mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-10 04:40:10 +07:00
Comments
This commit is contained in:
parent
e7b6013d8d
commit
da3c11a201
@ -9,11 +9,19 @@ import mindustry.entities.*;
|
|||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
|
||||||
public class MovementLightningAbility extends Ability{
|
public class MovementLightningAbility extends Ability{
|
||||||
public float damage = 35f, reload = 0.15f;
|
//Lightning damage
|
||||||
|
public float damage = 35f;
|
||||||
|
//Ticks between firing
|
||||||
|
public float reload = 15f;
|
||||||
|
//Length of lightning
|
||||||
public int length = 12;
|
public int length = 12;
|
||||||
|
//Speeds for when to start lightninging and when to stop getting faster
|
||||||
public float minSpeed = 0.8f, maxSpeed = 1.2f;
|
public float minSpeed = 0.8f, maxSpeed = 1.2f;
|
||||||
|
//Shoot effect
|
||||||
public Effect shootEffect = Fx.sparkShoot;
|
public Effect shootEffect = Fx.sparkShoot;
|
||||||
|
//Shoot sound
|
||||||
public Sound shootSound = Sounds.spark;
|
public Sound shootSound = Sounds.spark;
|
||||||
|
//Lightning Color
|
||||||
public Color color = Color.valueOf("a9d8ff");
|
public Color color = Color.valueOf("a9d8ff");
|
||||||
|
|
||||||
MovementLightningAbility(){}
|
MovementLightningAbility(){}
|
||||||
@ -30,7 +38,7 @@ public class MovementLightningAbility extends Ability{
|
|||||||
@Override
|
@Override
|
||||||
public void update(Unit unit){
|
public void update(Unit unit){
|
||||||
float scl = Mathf.clamp((unit.vel().len() - minSpeed) / (maxSpeed - minSpeed));
|
float scl = Mathf.clamp((unit.vel().len() - minSpeed) / (maxSpeed - minSpeed));
|
||||||
if(Mathf.chance(Time.delta * (reload * scl))){
|
if(Mathf.chance(Time.delta * (reload/10 * scl))){
|
||||||
shootEffect.at(unit.x, unit.y, unit.rotation, color);
|
shootEffect.at(unit.x, unit.y, unit.rotation, color);
|
||||||
Lightning.create(unit.team, color, damage, unit.x + unit.vel().x, unit.y + unit.vel().y, unit.rotation, length);
|
Lightning.create(unit.team, color, damage, unit.x + unit.vel().x, unit.y + unit.vel().y, unit.rotation, length);
|
||||||
shootSound.at(unit.x, unit.y);
|
shootSound.at(unit.x, unit.y);
|
||||||
|
Loading…
Reference in New Issue
Block a user