Files
Mindustry/core/src/mindustry/entities/pattern/ShootSpread.java
MEEPofFaith 6d71bcd2eb Multi shotgun fix (#8460)
* Multi-barrel shotgun fix

* multi-recoil support

* @Nullable for everything
2023-04-03 16:38:10 -04:00

25 lines
651 B
Java

package mindustry.entities.pattern;
import arc.util.*;
public class ShootSpread extends ShootPattern{
/** spread between bullets, in degrees. */
public float spread = 5f;
public ShootSpread(int shots, float spread){
this.shots = shots;
this.spread = spread;
}
public ShootSpread(){
}
@Override
public void shoot(int totalShots, BulletHandler handler, @Nullable Runnable barrelIncrementer){
for(int i = 0; i < shots; i++){
float angleOffset = i * spread - (shots - 1) * spread / 2f;
handler.shoot(0, 0, angleOffset, firstShotDelay + shotDelay * i);
}
}
}