Il libro col 42 su una panca della Pieve (dentro la domanda); il cancello verde del tennis è dietro l'albero; i primi piani sopra al buio

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ApqNBvNbNCwXqR2RLo8QJh
This commit is contained in:
2026-10-24 22:24:52 +02:00
co-authored by Claude Opus 5.5
parent 10f15e69c1
commit e02a206be2
8 changed files with 57 additions and 4 deletions
+5 -2
View File
@@ -21,7 +21,7 @@ function drawShape(ctx, s) {
else for (let y = y0; y <= y1; y += step) ctx.fillRect(x0, y, x1 - x0, 1);
} else if (s.text) {
ctx.fillStyle = s.fill;
ctx.font = 'bold 11px monospace';
ctx.font = s.size ? `${s.size}px "Press Start 2P", monospace` : 'bold 11px monospace';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.fillText(s.text, ...s.at);
@@ -147,7 +147,9 @@ export function render(ctx, game, { hover, spots, debug, time = performance.now(
if (bg) ctx.drawImage(bg, 0, 0, WIDTH, HEIGHT);
for (const shape of scene.art ?? []) drawShape(ctx, shape);
// Una forma può avere la sua condizione (`when`): la chiavetta nella griglia sparisce quando la si prende.
for (const h of game.hotspots()) for (const shape of h.art ?? []) if (check(shape.when, game.state)) drawShape(ctx, shape);
// I primi piani (`top`) invece vanno sopra a tutto, anche al buio e alle candele: si disegnano dopo.
const art = game.hotspots().flatMap(h => (h.art ?? []).filter(shape => check(shape.when, game.state)));
for (const shape of art) if (!shape.top) drawShape(ctx, shape);
// Andrea e i personaggi della scena, dal più lontano al più vicino.
const andrea = sprites.get('andrea');
const drawAndreaNow = () => andrea ? drawSprite(ctx, andrea, game.pose(), s.x, s.y, game.scaleAt(s.y), s.facing)
@@ -159,6 +161,7 @@ export function render(ctx, game, { hover, spots, debug, time = performance.now(
}
for (const q of queue.sort((a, b) => a.y - b.y)) q.draw();
drawLights(ctx, scene, time);
for (const shape of art) if (shape.top) drawShape(ctx, shape);
if (spots) drawSpots(ctx, game);
if (debug) drawDebug(ctx, game, debug);
if (hover) {
+32 -2
View File
@@ -513,6 +513,36 @@ export const story = {
depth: [[256, 0.7], [360, 1.7]],
entry: [320, 352],
hotspots: [
// Il libro dimenticato su una panca (idea di Andrea, 24 ottobre): in copertina la risposta, dentro la domanda.
{
id: 'libro_panca', name: 'libro su una panca', box: [112, 262, 30, 18], at: [278, 318], face: 'left',
art: [
{ rect: [120, 270, 14, 4], fill: '#7a1f1f' }, { rect: [121, 273, 12, 1], fill: '#efe3c0' }, { rect: [126, 271, 3, 2], fill: '#e8c25a' },
// Da vicino: la copertina col 42, poi l'unica pagina con la domanda.
{ when: 'copertina_42', top: true, rect: [255, 60, 130, 170], fill: '#7a1f1f' },
{ when: 'copertina_42', top: true, rect: [263, 68, 114, 154], fill: '#8e2a26' },
{ when: 'copertina_42', top: true, text: '42', at: [320, 146], size: 48, fill: '#e8c25a' },
{ when: 'pagina_domanda', top: true, rect: [240, 70, 160, 150], fill: '#f1e6c4' },
{ when: 'pagina_domanda', top: true, rect: [240, 70, 160, 4], fill: '#d8c79a' },
{ when: 'pagina_domanda', top: true, text: 'Qual era', at: [320, 132], size: 12, fill: '#2a1f30' },
{ when: 'pagina_domanda', top: true, text: 'la domanda?', at: [320, 156], size: 12, fill: '#2a1f30' },
],
actions: {
look: [
{ set: 'copertina_42' },
{ say: 'Un libro dimenticato su una panca. In copertina, niente titolo: solo un numero. 42.' },
{ unset: 'copertina_42' },
],
open: [
{ say: 'Vediamo cosa c\'è dentro...' },
{ set: 'pagina_domanda' },
{ say: 'Una pagina sola: «Qual era la domanda?».' },
{ unset: 'pagina_domanda' },
{ say: 'Ecco. La risposta ce l\'hanno tutti: è la domanda che non si ricorda nessuno.' },
],
take: [{ say: 'Lo lascio dov\'è. Qualcun altro potrebbe cercare la stessa domanda.' }],
},
},
{
id: 'altare', name: 'altare', box: [270, 186, 100, 64], at: [320, 262], face: 'up',
actions: {
@@ -1295,7 +1325,7 @@ export const story = {
},
},
{
id: 'al_cancello', name: 'dal cancello verde, verso il posticino della Carza', box: [380, 300, 120, 60], at: [440, 330], exit: { scene: 'carza', at: [440, 290], face: 'left' },
id: 'al_cancello', name: 'dal cancello verde, verso il posticino della Carza', box: [470, 140, 120, 130], at: [515, 280], exit: { scene: 'carza', at: [440, 290], face: 'left' },
},
],
},
@@ -1483,7 +1513,7 @@ export const story = {
},
},
{
id: 'cancello', name: 'cancello verde, verso il tennis della chiesa', box: [460, 150, 46, 132], at: [440, 290], face: 'right', exit: { scene: 'tennis_chiesa', at: [440, 330], face: 'up' },
id: 'cancello', name: 'cancello verde, verso il tennis della chiesa', box: [460, 150, 46, 132], at: [440, 290], face: 'right', exit: { scene: 'tennis_chiesa', at: [515, 285], face: 'left' },
actions: {
look: [{ say: 'Il cancello verde, sempre aperto. Di là c\'è il tennis della chiesa.' }],
},