mirror of
https://github.com/Such-Software/wownerogue.git
synced 2026-11-27 09:23:55 +01:00
fix(ux): honest block-time wording + smooth (lerped) SP camera
- Modal: "Safe — full block window" overstated it (blocks arrive randomly, Poisson). Now "Start fresh · blocks land at random" / "Jump in · race the time left". - Camera: was snapping to the player every frame (jerky on canvas resize / level teleport). Now glides (lerp 0.3) and only snaps on a big jump; snap-centers on new-game start.
This commit is contained in:
@@ -1770,8 +1770,8 @@ const SocketHandlers = {
|
||||
'<div style="padding:15px 18px;">' +
|
||||
'<div style="font-size:10px;letter-spacing:2px;color:#5d6a4c;text-transform:uppercase;font-weight:bold;margin-bottom:7px;">1 · When do you drop in?</div>' +
|
||||
'<div style="display:flex;gap:8px;margin-bottom:15px;">' +
|
||||
seg('ecWait', timing === 'wait', '🛡 Next block', 'Safe — full block window', false) +
|
||||
seg('ecNow', timing === 'now', '⚡ Right now', 'Risky — die on next block', true) +
|
||||
seg('ecWait', timing === 'wait', '🛡 Next block', 'Start fresh · blocks land at random', false) +
|
||||
seg('ecNow', timing === 'now', '⚡ Right now', 'Jump in · race the time left', true) +
|
||||
'</div>' +
|
||||
'<div style="font-size:10px;letter-spacing:2px;color:#5d6a4c;text-transform:uppercase;font-weight:bold;margin-bottom:7px;">2 · Choose your stakes</div>' +
|
||||
(freeAvailable ? stake('ecFree', '🆓', 'Free Play', 'No cost · Pleb leaderboard', '#123a17') : '') +
|
||||
|
||||
@@ -107,7 +107,15 @@
|
||||
if (!fp) { r.canvas.style.transform = 'scale(' + scale + ')'; return; }
|
||||
var w = host.clientWidth || 640, h = host.clientHeight || 400;
|
||||
var tx = w / 2 - fp.x * scale, ty = h / 2 - fp.y * scale;
|
||||
r.canvas.style.transform = 'translate(' + tx + 'px,' + ty + 'px) scale(' + scale + ')';
|
||||
// Smooth follow: glide toward the target so single steps aren't jerky; SNAP on a big jump
|
||||
// (level-change teleport / a stale-then-updated focus) rather than slowly panning the map.
|
||||
if (SP._camX == null || Math.abs(tx - SP._camX) > w || Math.abs(ty - SP._camY) > h) {
|
||||
SP._camX = tx; SP._camY = ty;
|
||||
} else {
|
||||
SP._camX += (tx - SP._camX) * 0.3;
|
||||
SP._camY += (ty - SP._camY) * 0.3;
|
||||
}
|
||||
r.canvas.style.transform = 'translate(' + SP._camX + 'px,' + SP._camY + 'px) scale(' + scale + ')';
|
||||
};
|
||||
|
||||
function toggleLegacy(hide) {
|
||||
@@ -128,6 +136,7 @@
|
||||
host.style.display = 'block';
|
||||
toggleLegacy(true);
|
||||
SP._live = true;
|
||||
SP._camX = null; // snap-center on the first frame of a new game
|
||||
SP._startCameraLoop();
|
||||
return true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user