animations

This commit is contained in:
ryanfitzpatrickio
2026-08-03 19:20:00 -05:00
parent fb1ebeed05
commit afd764e5e7
22 changed files with 2049 additions and 212 deletions
+56 -4
View File
@@ -228,7 +228,8 @@ section('triggers are analog, not boolean');
h.press(PAD.LT, 1);
s = h.input.read(1 / 60);
ok(s.brake, 'the left trigger stops');
ok(s.backskate, 'the left trigger is backskating (EA LT)');
ok(!s.brake, 'and is not a hockey stop');
ok(s.protect > 0.9, `and reports analog (${s.protect.toFixed(2)})`);
h.restore();
}
@@ -260,6 +261,29 @@ section('buttons report as actions, and only on the edge');
h.restore();
}
section('RB holds stick-spread and blocks the Skill Stick wind-up');
{
const h = harness();
const dt = 1 / 60;
h.input.read(dt);
h.press(PAD.RB);
let s = h.input.read(dt);
ok(s.spread, 'RB is stick-spread');
ok(s.held.deke, 'and is held on the deke binding');
// Skill Stick wound back while spreading must not charge a shot.
h.pad.axes = [0, 0, 0, 1];
for (let i = 0; i < 20; i++) s = h.input.read(dt);
near(s.charge, 0, 1e-9, 'no wind-up charge while spreading');
ok(s.shot === null, 'and no shot fires from the skill stick');
h.release(PAD.RB);
s = h.input.read(dt);
ok(!s.spread, 'releasing RB ends the spread');
h.restore();
}
section('the Skill Stick fires a shot on pull-back-and-push');
{
const h = harness();
@@ -322,17 +346,42 @@ section('an abandoned wind-up is forgotten, not banked');
h.restore();
}
section('the shot carries aim from the stick');
section('the shot carries aim from how you moved during the wind-up');
{
const h = harness();
const dt = 1 / 60;
h.input.read(dt);
h.pad.axes = [0, 0, 0.8, 1]; // wound back, stick held to the right
// Wind up while holding left stick right — that is the aim sample.
// Right stick is pulled back (pad Y +) with no lateral skill aim.
h.pad.axes = [0.85, 0, 0, 1];
let s;
for (let i = 0; i < 20; i++) s = h.input.read(dt);
ok(s.charge > 0.2, 'winding up');
ok(s.aimHint > 0.4, `live aim hint follows the move stick (${s.aimHint.toFixed(2)})`);
// Release: still holding left-right, skill stick forward.
h.pad.axes = [0.85, 0, 0, -1];
s = h.input.read(dt);
ok(s.shot, 'the shot fired');
ok(s.shot.move.x > 0.5, `move sample is right (${s.shot.move.x.toFixed(2)})`);
ok(Math.abs(s.shot.skillAim) < 0.2, `skill lateral is not the aim (${s.shot.skillAim.toFixed(2)})`);
ok(s.shot.aim > 0.4, `combined aim hint is right (${s.shot.aim.toFixed(2)})`);
h.restore();
}
section('Skill Stick lateral is recorded as a fine-tune, not primary aim');
{
const h = harness();
const dt = 1 / 60;
h.input.read(dt);
// No move stick; Skill Stick wound back and held right.
h.pad.axes = [0, 0, 0.8, 1];
for (let i = 0; i < 20; i++) h.input.read(dt);
h.pad.axes = [0, 0, 0.8, -1];
const s = h.input.read(dt);
ok(s.shot, 'the shot fired');
ok(s.shot.aim > 0.5, `and remembers it was aimed right (${s.shot.aim.toFixed(2)})`);
ok(s.shot.skillAim > 0.5, `skillAim remembers the right push (${s.shot.skillAim.toFixed(2)})`);
near(s.shot.move.x, 0, 0.15, 'move sample stayed near centre');
h.restore();
}
@@ -340,10 +389,13 @@ section('the shoot button works for anyone who never learns the Skill Stick');
{
const h = harness();
h.input.read(1 / 60);
// Aim with left stick, fire with X.
h.pad.axes = [-0.9, 0, 0, 0];
h.press(PAD.X);
const s = h.input.read(1 / 60);
ok(s.shot, 'X shoots');
ok(s.shot.power > 0 && s.shot.power <= 1, `at a sensible power (${s.shot.power.toFixed(2)})`);
ok(s.shot.move.x < -0.5, `and samples the move stick for aim (${s.shot.move.x.toFixed(2)})`);
h.restore();
}