diff --git a/assets/_sheet_death5.png b/assets/_sheet_death5.png new file mode 100644 index 0000000..9067ac8 Binary files /dev/null and b/assets/_sheet_death5.png differ diff --git a/assets/_sheet_woundpass.png b/assets/_sheet_woundpass.png new file mode 100644 index 0000000..f640453 Binary files /dev/null and b/assets/_sheet_woundpass.png differ diff --git a/assets/p_die1.png b/assets/p_die1.png index 1d9c619..a873485 100644 Binary files a/assets/p_die1.png and b/assets/p_die1.png differ diff --git a/assets/p_die2.png b/assets/p_die2.png index e6f2f04..69f82ac 100644 Binary files a/assets/p_die2.png and b/assets/p_die2.png differ diff --git a/assets/p_die3.png b/assets/p_die3.png new file mode 100644 index 0000000..3a7bcf2 Binary files /dev/null and b/assets/p_die3.png differ diff --git a/assets/p_die4.png b/assets/p_die4.png new file mode 100644 index 0000000..834eec0 Binary files /dev/null and b/assets/p_die4.png differ diff --git a/assets/p_die5.png b/assets/p_die5.png new file mode 100644 index 0000000..adadea8 Binary files /dev/null and b/assets/p_die5.png differ diff --git a/assets/z_awb.png b/assets/z_awb.png index e857c2d..43ea7bc 100644 Binary files a/assets/z_awb.png and b/assets/z_awb.png differ diff --git a/assets/z_bwb.png b/assets/z_bwb.png index 2f67aa5..1c32651 100644 Binary files a/assets/z_bwb.png and b/assets/z_bwb.png differ diff --git a/assets/z_dwb.png b/assets/z_dwb.png index 0c6f412..4319dac 100644 Binary files a/assets/z_dwb.png and b/assets/z_dwb.png differ diff --git a/index.html b/index.html index 35e191c..0b87adb 100644 --- a/index.html +++ b/index.html @@ -97,6 +97,6 @@

- + diff --git a/render.js b/render.js index 700e194..410357a 100644 --- a/render.js +++ b/render.js @@ -155,9 +155,9 @@ export function proj(x, y, z) { // ---------------------------------------------------------------- sprites ---- // assets/.png; game falls back to code-drawn figures until sprites load. -const SPRV = 59; // asset cache-buster — bump with main.js?v=N (see the img.src note below) +const SPRV = 60; // asset cache-buster — bump with main.js?v=N (see the img.src note below) const SPR = {}; -for (const n of ['p_idle1','p_idle2','p_bounce','p_bounce2','p_toss','p_smash','p_run1','p_run2','p_run3','p_run4','p_swing1','p_swing2','p_die1','p_die2', +for (const n of ['p_idle1','p_idle2','p_bounce','p_bounce2','p_toss','p_smash','p_run1','p_run2','p_run3','p_run4','p_swing1','p_swing2','p_die1','p_die2','p_die3','p_die4','p_die5', 'o_idle1','o_idle2','o_bounce','o_bounce2','o_toss','o_smash','o_run1','o_run2','o_swing1','o_swing2', 'x_ump','x_boyrun1','x_boyrun2','x_boyrun3','x_boyrun4','x_crowd','x_crowd2','x_ads', 'x_boymop1','x_boymop2','x_boymop3','x_boymop4', // the push cycle, used only while he is stopped and working @@ -506,23 +506,26 @@ function drawChar(ch) { // alternating), then pulled flat and pressed DOWN into the ground as the ring of bodies closes over // him — he is drawn inside the crowd's own z order (see render()), so the ones between him and the // camera hide him exactly as they arrive. What is left when he is gone is the mound. +// Five DRAWN frames, arched back -> knees -> hands -> flat -> a heap, each one genuinely shorter +// than the last (100/84/60/47/20% of standing height, common-scaled off one sheet). The first pass +// faked the collapse by scaling one sprite down, which is miniaturising a man, not killing him. +// Nothing here is scaled: each frame is drawn at ITS OWN height, the same rule the walk cycles use. +const DIE_AT = [0, 0.15, 0.35, 0.6, 0.8]; // fraction of the way to EATEN_BURST each frame takes over function drawDying() { const at = G.eatenAt || P, t = G.eatenT; if (t >= EATEN_BURST) return; // he is the pile now - const struggling = t < EATEN_GRAB; - const name = struggling ? (Math.floor(t * 11) % 2 ? 'p_die1' : 'p_die2') : 'p_die2'; - const img = SPR[name]; + const k = t / EATEN_BURST; + let i = 0; while (i + 1 < DIE_AT.length && k >= DIE_AT[i + 1]) i++; + const img = SPR['p_die' + (i + 1)]; const p = proj(at.x, 0, at.z); - const sink = struggling ? 0 : Math.min(1, (t - EATEN_GRAB) / (EATEN_BURST - EATEN_GRAB)); // 0..1 going under - const j = struggling ? 1.6 : 0.6; // he stops fighting as he goes down + const j = i < 2 ? 1.6 : i < 4 ? 0.7 : 0; // he stops fighting on the way down ctx.save(); ctx.translate((Math.random() * 2 - 1) * j, (Math.random() * 2 - 1) * j * 0.6); if (img) { - const h = PLAYER_H * p.s * (img.height / SPRITE_H) * (1 - 0.8 * sink); // pressed into the ground - const w = h * img.width / img.height; + const h = PLAYER_H * p.s * (img.height / SPRITE_H), w = h * img.width / img.height; drawShadow(p.x, p.y, w * 0.42, h * 0.06, 0.3); ctx.drawImage(img, p.x - w / 2, p.y - h, w, h); - } else drawFallbackChar(P, p, PLAYER_H * p.s * (1 - 0.8 * sink)); // sprites not loaded: still dies + } else drawFallbackChar(P, p, PLAYER_H * p.s); // sprites not loaded: he still dies ctx.restore(); }