Musica, vecchietti con sprite, nuove scene del paese e generatore degli sfondi

Lavoro della sessione precedente: colonna sonora (titolo, paese, ricordi) con muto e volume,
vecchietta e vecchietto sulla panchina, scene di Pieve, oratorio, Via de' Medici, Villa Adami,
salita, campeggio, Bosco ai Frati e viale dei cipressi, panorama dell'introduzione,
tools/genera.py per gli sfondi dalle foto.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UdeKd62opy9PKgpQXtVctF
This commit is contained in:
2026-10-23 12:59:57 +02:00
co-authored by Claude Opus 5.5
parent 5eeb634ceb
commit 33e2598718
45 changed files with 1556 additions and 78 deletions
+30
View File
@@ -0,0 +1,30 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { existsSync } from 'node:fs';
import { trackFor, Music } from '../src/engine/music.js';
import { story } from '../src/story/story.js';
test('il brano giusto per titolo, fine e scena', () => {
const s = { music: { title: 't.mp3', game: 'g.mp3', ending: 'e.mp3' }, scenes: { a: {}, b: { music: 'b.mp3' } } };
assert.equal(trackFor(s, { screen: 'title', scene: 'a' }), 't.mp3');
assert.equal(trackFor(s, { screen: 'intro', scene: 'a' }), 't.mp3');
assert.equal(trackFor(s, { screen: 'ending', scene: 'a' }), 'e.mp3');
assert.equal(trackFor(s, { screen: 'game', scene: 'a' }), 'g.mp3');
assert.equal(trackFor(s, { screen: 'game', scene: 'b' }), 'b.mp3');
assert.equal(trackFor({ scenes: {} }, { screen: 'game', scene: 'x' }), null);
});
test('volume e muto', () => {
const m = new Music({ volume: 0.5, muted: true });
assert.equal(m.setVolume(1.4), 1);
assert.equal(m.muted, false, 'alzare il volume toglie il muto');
assert.equal(m.toggle(), true);
assert.equal(m.setVolume(-1), 0);
assert.deepEqual(m.settings(), { volume: 0, muted: true });
});
test('i brani della storia esistono', () => {
const files = [...Object.values(story.music ?? {}), ...Object.values(story.scenes).map(s => s.music).filter(Boolean)];
assert.ok(files.length);
for (const f of files) assert.ok(existsSync(new URL('../' + f, import.meta.url)), `manca ${f}`);
});