Hastily implemented final endgame turret
This commit is contained in:
@@ -6,7 +6,7 @@ import mindustry.entities.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
public class FlakBulletType extends BasicBulletType{
|
||||
public float explodeRange = 30f, explodeDelay = 5f;
|
||||
public float explodeRange = 30f, explodeDelay = 5f, flakInterval = 6f;
|
||||
|
||||
public FlakBulletType(float speed, float damage){
|
||||
super(speed, damage, "shell");
|
||||
@@ -27,12 +27,12 @@ public class FlakBulletType extends BasicBulletType{
|
||||
super.update(b);
|
||||
|
||||
//don't check for targets if primed to explode
|
||||
if(b.fdata >= 0 && b.timer(2, 6)){
|
||||
if(b.fdata >= 0 && b.timer(2, flakInterval)){
|
||||
Units.nearbyEnemies(b.team, Tmp.r1.setSize(explodeRange * 2f).setCenter(b.x, b.y), unit -> {
|
||||
//fadata < 0 means it's primed to explode
|
||||
if(b.fdata < 0f || !unit.checkTarget(collidesAir, collidesGround)) return;
|
||||
|
||||
if(unit.within(b, explodeRange)){
|
||||
if(unit.within(b, explodeRange + unit.hitSize/2f)){
|
||||
//mark as primed
|
||||
b.fdata = -1f;
|
||||
Time.run(explodeDelay, () -> {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package mindustry.entities.pattern;
|
||||
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
|
||||
public class ShootSummon extends ShootPattern{
|
||||
public float x, y, radius, spread;
|
||||
|
||||
public ShootSummon(float x, float y, float radius, float spread){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.radius = radius;
|
||||
this.spread = spread;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shoot(int totalShots, BulletHandler handler){
|
||||
|
||||
|
||||
for(int i = 0; i < shots; i++){
|
||||
Tmp.v1.trns(Mathf.random(360f), Mathf.random(radius));
|
||||
|
||||
handler.shoot(x + Tmp.v1.x, y + Tmp.v1.y, Mathf.range(spread), firstShotDelay + shotDelay * i);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user