Non-hexagonal force projectors (#8358)

This commit is contained in:
MEEPofFaith 2023-03-08 06:16:07 -08:00 committed by GitHub
parent 2cc486febc
commit a046f0f11b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,6 +30,8 @@ public class ForceProjector extends Block{
public float phaseRadiusBoost = 80f;
public float phaseShieldBoost = 400f;
public float radius = 101.7f;
public int sides = 6;
public float shieldRotation = 0f;
public float shieldHealth = 700f;
public float cooldownNormal = 1.75f;
public float cooldownLiquid = 1.5f;
@ -46,7 +48,7 @@ public class ForceProjector extends Block{
protected static ForceBuild paramEntity;
protected static Effect paramEffect;
protected static final Cons<Bullet> shieldConsumer = bullet -> {
if(bullet.team != paramEntity.team && bullet.type.absorbable && Intersector.isInsideHexagon(paramEntity.x, paramEntity.y, paramEntity.realRadius() * 2f, bullet.x, bullet.y)){
if(bullet.team != paramEntity.team && bullet.type.absorbable && Intersector.isInRegularPolygon(((ForceProjector)(paramEntity.block)).sides, paramEntity.x, paramEntity.y, paramEntity.realRadius() * 2f, ((ForceProjector)(paramEntity.block)).shieldRotation, bullet.x, bullet.y)){
bullet.absorb();
paramEffect.at(bullet);
paramEntity.hit = 1f;
@ -109,10 +111,10 @@ public class ForceProjector extends Block{
Draw.color(Pal.gray);
Lines.stroke(3f);
Lines.poly(x * tilesize + offset, y * tilesize + offset, 6, radius);
Lines.poly(x * tilesize + offset, y * tilesize + offset, sides, radius, shieldRotation);
Draw.color(player.team().color);
Lines.stroke(1f);
Lines.poly(x * tilesize + offset, y * tilesize + offset, 6, radius);
Lines.poly(x * tilesize + offset, y * tilesize + offset, sides, radius, shieldRotation);
Draw.color();
}
@ -246,13 +248,13 @@ public class ForceProjector extends Block{
Draw.color(team.color, Color.white, Mathf.clamp(hit));
if(renderer.animateShields){
Fill.poly(x, y, 6, radius);
Fill.poly(x, y, sides, radius, shieldRotation);
}else{
Lines.stroke(1.5f);
Draw.alpha(0.09f + Mathf.clamp(0.08f * hit));
Fill.poly(x, y, 6, radius);
Fill.poly(x, y, sides, radius, shieldRotation);
Draw.alpha(1f);
Lines.poly(x, y, 6, radius);
Lines.poly(x, y, sides, radius, shieldRotation);
Draw.reset();
}
}