La catena del ghiacciolo: la Tosca e le bibite, ghiacciolo nella cedrata, stecco e gomma, la chiavetta nella griglia del ponticino, la torcia nella casetta

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017egeN2amL84ErjfgQFtEDn
This commit is contained in:
2026-10-24 00:49:37 +02:00
co-authored by Claude Opus 5.5
parent 64a57d6524
commit 066f9ff9ed
63 changed files with 331 additions and 26 deletions
+3 -1
View File
@@ -1,5 +1,6 @@
// Disegno della scena su un canvas 640×360, ingrandito dal CSS senza sfocatura.
// Le forme provvisorie (`art`) verranno sostituite da sfondi e sprite in pixel art.
import { check } from './game.js';
export const WIDTH = 640, HEIGHT = 360;
function drawShape(ctx, s) {
@@ -108,7 +109,8 @@ export function render(ctx, game, { hover, spots } = {}) {
ctx.clearRect(0, 0, WIDTH, HEIGHT);
if (bg) ctx.drawImage(bg, 0, 0, WIDTH, HEIGHT);
for (const shape of scene.art ?? []) drawShape(ctx, shape);
for (const h of game.hotspots()) for (const shape of h.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);
// 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)