Skip to content

Commit 65b42e2

Browse files
committed
Scale from split source
1 parent b216b29 commit 65b42e2

File tree

2 files changed

+31
-13
lines changed

2 files changed

+31
-13
lines changed

src/progressed/content/bullets/PayloadBullets.java

+3
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ public static void load(){
269269
homingPower = 0.5f;
270270

271271
drawZone = false;
272+
growTime = 6f;
272273
trailColor = targetColor = zoneColor = Pal.suppress;
273274
trailLength = 12;
274275
trailWidth = 1f;
@@ -320,6 +321,7 @@ public static void load(){
320321
homingRange = 30f * 8f;
321322

322323
hitShake = 5f;
324+
growTime = 20f;
323325
despawnEffect = MissileFx.missileExplosion;
324326
absorbEffect = Pseudo3DFx.absorbed;
325327

@@ -534,6 +536,7 @@ public void createFrags(Bullet b, float x, float y){
534536
enough.fragBullet = cease;
535537
enough.arcFragDrift = 5f;
536538
enough.targetDriftDrag = 0.01f;
539+
enough.growTime = 20f;
537540

538541
ohno.fragBullet = enough;
539542
}

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

+28-13
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class ArcBulletType extends BulletType{
4343
public float spokeWidth = 2f, spokeLength = 8f;
4444
public float spikeSpin = 0.5f;
4545
public float zoneLifeOffset = 0f;
46-
public float growTime = 6f, shrinkTime = 0f;
46+
public float growTime = 10f, shrinkTime = 0f;
4747
public Color zoneColor = Color.red, targetColor = Color.red;
4848

4949
static{
@@ -89,6 +89,7 @@ public void init(){
8989
if(fragBullet instanceof ArcBulletType a){
9090
a.isInheritive = true;
9191
a.zoneLifeOffset = a.zoneLifeOffset * a.lifetimeScl + lifetimeScl;
92+
shrinkTime = 0;
9293
}
9394

9495
if(intervalBullet instanceof ArcBulletType a) a.isInheritive = true;
@@ -190,7 +191,7 @@ public void createFrags(Bullet b, float x, float y){
190191
if(fragBullet instanceof ArcBulletType aType){
191192
for(int i = 0; i < fragBullets; i++){
192193
float a = b.rotation() + Mathf.range(fragRandomSpread / 2) + fragAngle + ((i - fragBullets/2f) * fragSpread);
193-
aType.create3DInherit(b, a, aType.arcFragDrift, false);
194+
((ArcBulletData)aType.create3DInherit(b, a, aType.arcFragDrift, false).data).splitFrom = (ArcBulletType)b.type;
194195
}
195196
}else{
196197
super.createFrags(b, x, y);
@@ -276,20 +277,30 @@ public void drawTargetZone(Bullet b){
276277
Draw.color(zoneColor);
277278

278279
float realLife = b.lifetime * lifetimeScl;
279-
float scl = Mathf.curve(b.time, 0, growTime) - Mathf.curve(b.time, realLife - shrinkTime, realLife);
280+
float grow = Mathf.curve(b.time, 0, growTime);
281+
float shrink = Mathf.curve(b.time, realLife - shrinkTime, realLife);
282+
float scl = grow - shrink;
283+
284+
ArcBulletType splitFrom = ((ArcBulletData)b.data).splitFrom;
285+
boolean split = splitFrom != null;
286+
if(split) grow = Interp.smooth.apply(grow);
287+
float fout = 1 - shrink;
280288

281289
float x = b.aimX, y = b.aimY;
282290
float ang = Mathf.randomSeed(b.id, 360) + b.time * spikeSpin;
283-
float zR = zoneRadius * scl;
284-
if(drawZone && zR > 0f){
291+
if(drawZone){
292+
float zR = split ? Mathf.lerp(splitFrom.zoneRadius, zoneRadius, grow) * fout : zoneRadius * scl;
285293
PMDrawf.ring(x, y, zR, zR + 2f);
286-
float sW1 = spikesWidth1 * scl, sL1 = spikesLength1 * scl;
294+
295+
float sW1 = split ? Mathf.lerp(splitFrom.spikesWidth1, spikesWidth1, grow) * fout : spikesWidth1 * scl,
296+
sL1 = split ? Mathf.lerp(splitFrom.spikesLength1, spikesLength1, grow) * fout : spikesLength1 * scl;
287297
for(int i = 0; i < 4; i++){
288298
float a = ang + 90 * i;
289299
Drawf.tri(x + Angles.trnsx(a, zR), y + Angles.trnsy(a, zR), sW1, sL1, a + 180);
290300
Drawf.tri(x + Angles.trnsx(a, zR), y + Angles.trnsy(a, zR), sW1, sL1 / 2f, a);
291301
}
292-
float sW2 = spikesWidth2 * scl, sL2 = spikesLength2 * scl;
302+
float sW2 = split ? Mathf.lerp(splitFrom.spikesWidth2, spikesWidth2, grow) * fout : spikesWidth2 * scl,
303+
sL2 = split ? Mathf.lerp(splitFrom.spikesLength2, spikesLength2, grow) * fout : spikesLength2 * scl;
293304
for(int i = 0; i < 4; i++){
294305
float a = ang + 45 + 90 * i;
295306
Drawf.tri(x + Angles.trnsx(a, zR), y + Angles.trnsy(a, zR), sW2, sL2, a + 180);
@@ -298,14 +309,17 @@ public void drawTargetZone(Bullet b){
298309
}
299310

300311
float fin = b.fin() / lifetimeScl;
301-
PMDrawf.progressRing(x, y, progressRadius * scl, (progressRadius + 4f) * scl, fin);
302-
303-
PMDrawf.ring(x, y, targetRadius * scl, (targetRadius + 2f) * scl);
304-
Lines.stroke(spokeWidth * scl);
305-
float tR = targetRadius * scl;
312+
float pR = split ? Mathf.lerp(splitFrom.progressRadius, progressRadius, grow) * fout : progressRadius * scl;
313+
PMDrawf.progressRing(x, y, pR, pR + 4f, fin);
314+
315+
float tR = split ? Mathf.lerp(splitFrom.targetRadius, targetRadius, grow) * fout : targetRadius * scl,
316+
sW = split ? Mathf.lerp(splitFrom.spokeWidth, spokeWidth, grow) * fout : spokeWidth * scl,
317+
sL = split ? Mathf.lerp(splitFrom.spokeLength, spokeLength, grow) * fout : spokeLength * scl;
318+
PMDrawf.ring(x, y, tR, tR + 2);
319+
Lines.stroke(sW);
306320
for(int i = 0; i < 4; i++){
307321
float a = -ang + 90 * i;
308-
Lines.lineAngleCenter(x + Angles.trnsx(a, tR), y + Angles.trnsy(a, tR), a, spokeLength * scl, false);
322+
Lines.lineAngleCenter(x + Angles.trnsx(a, tR), y + Angles.trnsy(a, tR), a, sL, false);
309323
}
310324
}
311325

@@ -467,6 +481,7 @@ public static class ArcBulletData implements Cloneable{
467481
public float xAccel, yAccel;
468482
public float lastZ, z, zVel, gravity;
469483
public float targetDriftX, targetDriftY;
484+
public ArcBulletType splitFrom;
470485

471486
public ArcBulletData(float z, float zVel, float gravity){
472487
this.z = z;

0 commit comments

Comments
 (0)