diff --git a/assets/scenes/ingorgo-via-cipriani.png b/assets/scenes/ingorgo-via-cipriani.png new file mode 100644 index 0000000..34e9e57 Binary files /dev/null and b/assets/scenes/ingorgo-via-cipriani.png differ diff --git a/src/engine/render.js b/src/engine/render.js index 6d310d3..0d9a1c6 100644 --- a/src/engine/render.js +++ b/src/engine/render.js @@ -791,7 +791,7 @@ export function crowdFront(ctx, game, time, bg = backgrounds.get(game.backdrop() const dy = Math.round(amount * (0.4 + 0.6 * hash(i * 31 + 5)) * jump); // La testa di chi sta davanti: ogni striscia alla sua altezza, e salta col battito. const edge = Math.round(waist - h * 0.14 * hash(i * 7 + 3)) - dy; - const from = Math.max(edge, ay), to = Math.min(s.y + 3, ay + ah - dy); + const from = Math.max(edge, ay), to = Math.min(s.y + 3, ay + ah); if (to <= from) continue; const w = Math.min(step, ax + aw - x); ctx.drawImage(bg, x * k, (from + dy) * k, w * k, (to - from) * k, x, from, w, to - from); diff --git a/src/story/story.js b/src/story/story.js index 357b430..5bcd221 100644 --- a/src/story/story.js +++ b/src/story/story.js @@ -93,7 +93,7 @@ export const story = { // col manifesto in piazza e si spegne uscendo dal centro. [DA ANDREA: le battute sono provvisorie] zones: [ { - flag: 'ingorgo', scenes: ['piazza', 'via_antica_posta', 'piazzetta_comune', 'antica_posta_alta', 'piazzetta', 'via_calimara'], + flag: 'ingorgo', scenes: ['piazza', 'via_antica_posta', 'piazzetta_comune', 'antica_posta_alta', 'piazzetta', 'via_calimara', 'via_cipriani'], exitsOnly: true, // alla festa si clicca solo per spostarsi (Andrea) leave: [ { say: 'Mi stropiccio gli occhi. La musica non c\'è più: è di nuovo maggio.' }, @@ -1252,6 +1252,18 @@ export const story = { name: 'Via Pietro Cipriani', map: [22, 64], background: 'assets/scenes/via-cipriani.png', + backdrops: [{ when: 'ingorgo', src: 'assets/scenes/ingorgo-via-cipriani.png' }], // Codex, la notte dell'Ingorgo (31 ottobre) + // All'Ingorgo anche l'inizio di Via Cipriani (Andrea, 31 ottobre): la console sul campo da basket, le casse in + // cima alle scale, i laser rossi e lo strobo, e giù la gente che poga (la folla che salta, forte davanti). + // [DA ANDREA: la hardcore techno (Suno, ingorgo-hardcore.mp3); per ora arrivano la house dalla Piazza e la tecno] + effects: [{ type: 'crowd', phase: 'ingorgo', area: [0, 235, 640, 55], bpm: 180, amount: 3 }, { type: 'crowd', phase: 'ingorgo', area: [0, 290, 640, 70], bpm: 180, amount: 6 }, + { type: 'lasers', phase: 'ingorgo', at: [300, 160], count: 9, color: '255,40,40', len: 440 }, + { type: 'stagelights', phase: 'ingorgo', from: [[262, 152], [338, 152]], wash: [300, 172, 160], bpm: 180, beams: 2, strobe: 8, pulse: 0.1, colors: ['255,40,40', '255,255,255', '255,90,40'] }, + { type: 'floorspots', phase: 'ingorgo', area: [40, 240, 560, 110], bpm: 180, count: 7, colors: ['255,40,40', '255,255,255', '255,90,40'] }], + stages: [ + { when: 'ingorgo', music: 'assets/audio/ingorgo-house.mp3', at: [140, 60], far: 700 }, + { when: 'ingorgo', music: 'assets/audio/ingorgo-techno.mp3', at: [-250, 100], far: 800 }, + ], walk: [[40, 360], [40, 320], [60, 280], [100, 272], [150, 276], [300, 300], [360, 318], [640, 345], [640, 360]], depth: [[272, 0.45], [360, 1.15]], entry: [300, 345], diff --git a/tests/ingorgo.test.mjs b/tests/ingorgo.test.mjs index cc6ecdf..19f33d8 100644 --- a/tests/ingorgo.test.mjs +++ b/tests/ingorgo.test.mjs @@ -95,9 +95,9 @@ test('dal manifesto in piazza all\'Ingorgo: la battuta, l\'effetto, la festa; us const track = trackFor(story, { screen: 'game', scene, at: [g.state.x, g.state.y], ok: c => check(c, g.state) }); assert.ok(Array.isArray(track) && track.length >= 2, `${scene}: più console insieme`); } - g.go('via_cipriani'); settle(g); + g.go('via_massorondinaio'); settle(g); assert.ok(!g.state.flags.ingorgo, 'fuori dalla zona la festa sparisce'); - assert.equal(g.backdrop(), story.scenes.via_cipriani.background); + assert.equal(g.backdrop(), story.scenes.via_massorondinaio.background); }); test('chiudendo l\'effetto prima del lampo, la festa arriva lo stesso', () => { @@ -150,7 +150,7 @@ test('alla festa le luci da palco si muovono, e solo alla festa', () => { const frame = time => { ops.length = 0; render(ctx, g, { time }); return JSON.stringify(ops.filter(([op]) => op === 'lineTo' || op === 'fillRect')); }; assert.notEqual(frame(1000), frame(1700), `${scene}: le luci si muovono`); } - g.go('via_cipriani'); settle(g); g.go('piazza'); settle(g); + g.go('via_massorondinaio'); settle(g); g.go('piazza'); settle(g); ops.length = 0; render(ctx, g, { time: 1000 }); assert.ok(!ops.some(([op, x, y]) => op === 'moveTo' && x === 116 && y === 146), 'di giorno niente teste mobili'); } finally { delete globalThis.Image; }