All'Ingorgo Andrea sta dentro la folla: dalla vita in giù la gente dello sfondo gli passa davanti, a strisce che saltano a tempo con la folla e col bordo a teste (Andrea: «sembra di volare fra le persone»)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiECd9RWGMKV7n3K1mdy8T
This commit is contained in:
2026-10-31 15:17:01 +01:00
co-authored by Claude Opus 5.5
parent 23aa9c4788
commit 70f4e641dc
3 changed files with 60 additions and 0 deletions
+20
View File
@@ -168,6 +168,26 @@ test('le musiche e gli sfondi della festa esistono', () => {
for (const f of files) assert.ok(existsSync(new URL('../' + f, import.meta.url)), `manca ${f}`);
});
test('alla festa Andrea sta dentro la folla: dalla vita in giù la gente dello sfondo gli passa davanti', async () => {
const { crowdFront } = await import('../src/engine/render.js');
const g = new Game(story); g.go('piazzetta', [330, 320]); settle(g);
const calls = [], ctx = { drawImage: (...a) => calls.push(a) }, bg = { width: 1280 };
crowdFront(ctx, g, 0, bg);
assert.equal(calls.length, 0, 'di giorno, senza la festa, niente');
g.state.flags.ingorgo = true;
const { x, y } = g.state, h = 62 * g.scaleAt(y);
for (const time of [0, 250, 500]) {
calls.length = 0; crowdFront(ctx, g, time, bg);
assert.ok(calls.length > 3, 'strisce di folla sopra Andrea');
for (const [img, , , , , dx, dy, dw, dh] of calls) {
assert.equal(img, bg);
assert.ok(dx + dw > x - h * 0.4 && dx < x + h * 0.4, 'solo davanti a lui');
assert.ok(dy >= y - h * 0.75 && dy + dh <= y + 3, 'dalla vita in giù, fino ai piedi');
}
assert.ok(new Set(calls.map(c => c[6])).size > 1, 'il bordo in alto a teste, mai dritto');
}
});
test('alla festa la folla dipinta salta a tempo: l\'effetto crowd in tutte e cinque le scene, dietro piano e davanti forte', async () => {
const { EFFECTS } = await import('../src/engine/render.js');
assert.equal(typeof EFFECTS.crowd, 'function');