Versione del gioco (src/version.js, 0.1.0): immagini, musiche e voci con ?v=<versione> e cache lunga in nginx; scripts/bump.sh e make bump per le versioni nuove
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ks2K99uqCZjAxvy7Rdj1R
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// Le forme provvisorie (`art`) verranno sostituite da sfondi e sprite in pixel art.
|
||||
import { check } from './game.js';
|
||||
import { ambientEffects, ambientHash } from './ambient.js';
|
||||
import { versioned } from '../version.js';
|
||||
export const WIDTH = 640, HEIGHT = 360;
|
||||
|
||||
function drawShape(ctx, s) {
|
||||
@@ -64,7 +65,7 @@ const loadImage = src => new Promise(resolve => {
|
||||
const img = new Image();
|
||||
img.onload = () => resolve(img);
|
||||
img.onerror = () => resolve(null);
|
||||
img.src = src;
|
||||
img.src = versioned(src);
|
||||
});
|
||||
|
||||
export const hasBackground = src => backgrounds.has(src);
|
||||
@@ -96,7 +97,7 @@ export function loadBackground(src, now = Date.now()) {
|
||||
export async function loadAssets(story, first = story.start.scene, { together = 3 } = {}) {
|
||||
const people = Object.entries(story.characters).filter(([, c]) => c.sprite).map(async ([id, c]) => {
|
||||
try {
|
||||
const atlas = await (await fetch(c.sprite)).json();
|
||||
const atlas = await (await fetch(versioned(c.sprite))).json();
|
||||
const img = await loadImage(new URL(atlas.image, new URL(c.sprite, location.href)).href);
|
||||
if (img) sprites.set(id, { atlas, img });
|
||||
return !!img;
|
||||
|
||||
Reference in New Issue
Block a user