Fade melee swipes out over half a second with slight rotation jitter.
Swipe FX start opaque, lerp alpha to zero across 500ms, and add ±10° random yaw on top of aim rotation.
@@ -1512,16 +1512,23 @@ export class WorldView
1512
1512
const midY = (ay + ty) / 2;
1513
1513
const sortY = Math.max(ay, ty) + 0.02;
1514
1514
const angle = Math.atan2(ty - ay, tx - ax) * (180 / Math.PI);
1515
const jitter = (Math.random() * 2 - 1) * MELEE_SWIPE_JITTER_DEG;
1515
1516
const spriteName = "fx:melee-swipe:melee-swipe";
1516
1517
const object = new GameObject(0, 0, this.game.images[spriteName], SORT_FX);
1517
1518
if (object.transform)
1518
{ object.transform.rotation = angle; }
1519
{ object.transform.rotation = angle + jitter; }
1520
if (object.renderer)
1521
{ object.renderer.alpha = 1; }
1519
1522
this.scene.addObject(object);
1520
1523
this.#placePivoted(object, midX, midY, sortY, SORT_FX);
1521
1524
this.#applyPhysicalCombatFxDarkness(object, payload.fromTileX, payload.fromTileY, payload.tileX, payload.tileY);
1525
const started = performance.now();
1522
1526
this.swipes.push({
1523
1527
object,
1524
until: performance.now() + 500,
1528
until: started + MELEE_SWIPE_MS,
1529
started,
1530
durationMs: MELEE_SWIPE_MS,
1531
fadeOpacity: true,
1525
1532
fromTileX: payload.fromTileX,
1526
1533
fromTileY: payload.fromTileY,
1527
1534
tileX: payload.tileX,
@@ -4222,6 +4229,12 @@ export class WorldView
4222
4229
swipe.dualTint ?? null
4223
4230
);
4224
4231
}
4232
if (swipe.fadeOpacity && swipe.started != null && swipe.object?.renderer)
4233
{
4234
const durationMs = swipe.durationMs ?? MELEE_SWIPE_MS;
4235
const t = Math.min(1, Math.max(0, (now - swipe.started) / durationMs));
4236
swipe.object.renderer.alpha = 1 - t;
4237
}
4225
4238
if (swipe.until > now)
4226
4239
{ return true; }
4227
4240
const onImpact = swipe.onImpact;
@@ -1512,16 +1512,23 @@ export class WorldView1512
const midY = (ay + ty) / 2;1512
const midY = (ay + ty) / 2;1513
const sortY = Math.max(ay, ty) + 0.02;1513
const sortY = Math.max(ay, ty) + 0.02;1514
const angle = Math.atan2(ty - ay, tx - ax) * (180 / Math.PI);1514
const angle = Math.atan2(ty - ay, tx - ax) * (180 / Math.PI);1515
const jitter = (Math.random() * 2 - 1) * MELEE_SWIPE_JITTER_DEG;1515
const spriteName = "fx:melee-swipe:melee-swipe";1516
const spriteName = "fx:melee-swipe:melee-swipe";1516
const object = new GameObject(0, 0, this.game.images[spriteName], SORT_FX);1517
const object = new GameObject(0, 0, this.game.images[spriteName], SORT_FX);1517
if (object.transform)1518
if (object.transform)1518
{ object.transform.rotation = angle; }1519
{ object.transform.rotation = angle + jitter; }1520
if (object.renderer)1521
{ object.renderer.alpha = 1; }1519
this.scene.addObject(object);1522
this.scene.addObject(object);1520
this.#placePivoted(object, midX, midY, sortY, SORT_FX);1523
this.#placePivoted(object, midX, midY, sortY, SORT_FX);1521
this.#applyPhysicalCombatFxDarkness(object, payload.fromTileX, payload.fromTileY, payload.tileX, payload.tileY);1524
this.#applyPhysicalCombatFxDarkness(object, payload.fromTileX, payload.fromTileY, payload.tileX, payload.tileY);1525
const started = performance.now();1522
this.swipes.push({1526
this.swipes.push({1523
object,1527
object,1524
until: performance.now() + 500,1528
until: started + MELEE_SWIPE_MS,1529
started,1530
durationMs: MELEE_SWIPE_MS,1531
fadeOpacity: true,1525
fromTileX: payload.fromTileX,1532
fromTileX: payload.fromTileX,1526
fromTileY: payload.fromTileY,1533
fromTileY: payload.fromTileY,1527
tileX: payload.tileX,1534
tileX: payload.tileX,@@ -4222,6 +4229,12 @@ export class WorldView4222
swipe.dualTint ?? null4229
swipe.dualTint ?? null4223
);4230
);4224
}4231
}4232
if (swipe.fadeOpacity && swipe.started != null && swipe.object?.renderer)4233
{4234
const durationMs = swipe.durationMs ?? MELEE_SWIPE_MS;4235
const t = Math.min(1, Math.max(0, (now - swipe.started) / durationMs));4236
swipe.object.renderer.alpha = 1 - t;4237
}4225
if (swipe.until > now)4238
if (swipe.until > now)4226
{ return true; }4239
{ return true; }4227
const onImpact = swipe.onImpact;4240
const onImpact = swipe.onImpact;