Skip to content

Commit 398e73f

Browse files
committed
More interesting targetting zone
1 parent 2f49325 commit 398e73f

File tree

3 files changed

+51
-13
lines changed

3 files changed

+51
-13
lines changed

src/progressed/content/bullets/PayloadBullets.java

+1
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ public static void load(){
399399
trailWidth = 2.5f;
400400
trailColor = Pal.sapBulletBack; //Black doesn't work because of bloom
401401
targetColor = zoneColor = Color.black;
402+
zoneLayer = Layer.bullet - 0.03f;
402403

403404
accel = 0.01f;
404405
gravity = 0.02f;

src/progressed/entities/bullet/pseudo3d/ArcBulletType.java

+33-13
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@ public class ArcBulletType extends BulletType{
3636
public boolean bloomTrail = true;
3737

3838
public boolean drawZone = false;
39-
public float zoneLayer = Layer.bullet - 1f;
40-
public float targetRadius = 1f, zoneRadius = 3f * 8f, shrinkRad = -1f;
39+
public float zoneLayer = Layer.bullet;
40+
public float targetRadius = 12f, zoneRadius = 3f * 8f;
41+
public float shortSpikeWidth = -1f, shortSpike = -1f;
42+
public float longSpikeWidth = -1f, longSpike = -1f;
43+
public float spokeWidth = 2f, spokeLength = 8f;
44+
public float spikeSpin = 0.5f;
4145
public float zoneLifeOffset = 0f;
4246
public Color zoneColor = Color.red, targetColor = Color.red;
4347

@@ -75,6 +79,11 @@ public void initDrawSize(float range){
7579

7680
@Override
7781
public void init(){
82+
if(longSpike < 0) longSpike = zoneRadius / 2f;
83+
if(shortSpike < 0) shortSpike = longSpike / 2f;
84+
if(shortSpikeWidth < 0) shortSpikeWidth = shortSpike / 2f;
85+
if(longSpikeWidth < 0) longSpikeWidth = shortSpikeWidth;
86+
7887
if(fragBullet instanceof ArcBulletType a){
7988
a.isInheritive = true;
8089
a.zoneLifeOffset = a.zoneLifeOffset * a.lifetimeScl + lifetimeScl;
@@ -260,20 +269,31 @@ public void drawTrail(Bullet b){
260269
}
261270

262271
public void drawTargetZone(Bullet b){
263-
Draw.z(zoneLayer - 0.01f);
272+
Draw.z(zoneLayer);
273+
Draw.color(zoneColor);
274+
float x = b.aimX, y = b.aimY;
275+
float ang = Mathf.randomSeed(b.id, 360) + b.time * spikeSpin;
264276
if(drawZone && zoneRadius > 0f){
265-
Draw.color(zoneColor, 0.25f + 0.25f * Mathf.absin(16f, 1f));
266-
Fill.circle(b.aimX, b.aimY, zoneRadius);
267-
Draw.color(zoneColor, 0.5f);
268-
float fin = zoneLifeOffset + b.fin() * (1f - zoneLifeOffset);
269-
float subRad = fin * (zoneRadius + shrinkRad),
270-
inRad = Math.max(0, zoneRadius - subRad),
271-
outRad = Math.min(zoneRadius, zoneRadius + shrinkRad - subRad);
277+
PMDrawf.ring(x, y, zoneRadius, zoneRadius + 2f);
278+
for(int i = 0; i < 4; i++){
279+
float a = ang + 90 * i;
280+
Drawf.tri(x + Angles.trnsx(a, zoneRadius), y + Angles.trnsy(a, zoneRadius), shortSpikeWidth, shortSpike, a + 180);
281+
}
282+
for(int i = 0; i < 4; i++){
283+
float a = ang + 45 + 90 * i;
284+
Drawf.tri(x + Angles.trnsx(a, zoneRadius), y + Angles.trnsy(a, zoneRadius), longSpikeWidth, longSpike, a + 180);
285+
}
286+
}
287+
288+
float fin = zoneLifeOffset + b.fin() * (1f - zoneLifeOffset);
289+
PMDrawf.progressRing(x, y, zoneRadius + 4f, zoneRadius + 8f, fin);
272290

273-
PMDrawf.ring(b.aimX, b.aimY, inRad, outRad);
291+
PMDrawf.ring(x, y, targetRadius, targetRadius + 2f);
292+
Lines.stroke(spokeWidth);
293+
for(int i = 0; i < 4; i++){
294+
float a = -ang + 90 * i;
295+
Lines.lineAngleCenter(x + Angles.trnsx(a, targetRadius), y + Angles.trnsy(a, targetRadius), a, spokeLength, false);
274296
}
275-
Draw.z(zoneLayer);
276-
PMDrawf.target(b.aimX, b.aimY, Time.time * 1.5f + Mathf.randomSeed(b.id, 360f), targetRadius, targetColor != null ? targetColor : b.team.color, b.team.color, 1f);
277297
}
278298

279299
@Override

src/progressed/graphics/PMDrawf.java

+17
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,23 @@ public static void target(float x, float y, float angle, float radius, Color col
127127
target(x, y, angle, radius, color, color, alpha);
128128
}
129129

130+
public static void progressRing(float x, float y, float rad1, float rad2, float progress){
131+
if(Math.abs(rad1 - rad2) > 0.01f){
132+
int sides = (int)(circleVertices(Math.max(rad1, rad2)) * progress);
133+
float space = 360f * progress / sides;
134+
135+
for(int i = 0; i < sides; i++){
136+
float a = 90f - space * i, cos = Mathf.cosDeg(a), sin = Mathf.sinDeg(a), cos2 = Mathf.cosDeg(a - space), sin2 = Mathf.sinDeg(a - space);
137+
Fill.quad(
138+
x + rad1 * cos, y + rad1 * sin,
139+
x + rad1 * cos2, y + rad1 * sin2,
140+
x + rad2 * cos2, y + rad2 * sin2,
141+
x + rad2 * cos, y + rad2 * sin
142+
);
143+
}
144+
};
145+
}
146+
130147
public static void ring(float x, float y, float rad1, float rad2){
131148
if(Math.abs(rad1 - rad2) > 0.01f){
132149
int sides = circleVertices(Math.max(rad1, rad2));

0 commit comments

Comments
 (0)