I nomi dei crediti escono in ordine casuale a ogni apertura
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ApqNBvNbNCwXqR2RLo8QJh
This commit is contained in:
+13
-9
@@ -1,6 +1,6 @@
|
||||
// Avvio nel browser: collega motore, disegno e interfaccia HTML (verbi, inventario, dialoghi, fumetti).
|
||||
import { story } from './story/story.js';
|
||||
import { Game, VERBS, VERB_LABELS, checkSave, introText } from './engine/game.js';
|
||||
import { Game, VERBS, VERB_LABELS, checkSave, introText, shuffledCredits } from './engine/game.js';
|
||||
import { Command } from './engine/command.js';
|
||||
import { render, loadAssets, hasBackground, WIDTH, HEIGHT } from './engine/render.js';
|
||||
import { readSave, writeSave, clearSave, readAudio, writeAudio, saveFile, saveFileName, readSaveFile } from './engine/storage.js';
|
||||
@@ -100,14 +100,18 @@ function nextIntro() {
|
||||
$('intro').addEventListener('click', e => { if (e.target !== $('skip-intro')) nextIntro(); });
|
||||
$('skip-intro').addEventListener('click', () => { introLine = story.intro.length; nextIntro(); });
|
||||
|
||||
// --- Crediti: costruiti da story.credits; si aprono dal titolo e dalla fine, Chiudi o Esc tornano indietro.
|
||||
$('credits-list').replaceChildren(...(story.credits ?? []).flatMap(({ role, names }) => {
|
||||
const dt = document.createElement('dt'), dd = document.createElement('dd');
|
||||
dt.textContent = role;
|
||||
dd.replaceChildren(...names.map(n => Object.assign(document.createElement('span'), { textContent: n })));
|
||||
return [dt, dd];
|
||||
}));
|
||||
for (const b of document.querySelectorAll('.open-credits')) b.addEventListener('click', () => { $('credits').hidden = false; });
|
||||
// --- Crediti: costruiti da story.credits, con i nomi di ogni voce rimescolati a ogni apertura; si aprono dal titolo
|
||||
// e dalla fine, Chiudi o Esc tornano indietro.
|
||||
function openCredits() {
|
||||
$('credits-list').replaceChildren(...shuffledCredits(story.credits ?? []).flatMap(({ role, names }) => {
|
||||
const dt = document.createElement('dt'), dd = document.createElement('dd');
|
||||
dt.textContent = role;
|
||||
dd.replaceChildren(...names.map(n => Object.assign(document.createElement('span'), { textContent: n })));
|
||||
return [dt, dd];
|
||||
}));
|
||||
$('credits').hidden = false;
|
||||
}
|
||||
for (const b of document.querySelectorAll('.open-credits')) b.addEventListener('click', openCredits);
|
||||
$('close-credits').addEventListener('click', () => { $('credits').hidden = true; });
|
||||
|
||||
// --- Mappa: i posti visti e le strade fra loro; un clic su un posto ci porta (game.travel).
|
||||
|
||||
Reference in New Issue
Block a user