clone

a browser grid puzzle game where you push words around to rewrite the rules of each level

Polish automata cue glyphs and gutters

Dami committed aed5511
commit
aed55112b078949541db0b74d399dcf06962f36b
parent
868380043b805bdeae10ae580f99f98cbf8c52e0
author
Dami <dami.etoile@gmail.com>
4 files changed, +44 -25
Msrc/render/board.js39++++++++++++++----------------
Msrc/render/stage-hud.js8+++---
Mtests/board.test.js20+++++++++++++++
Mtests/stage-hud.test.js2++
M src/render/board.js +18 -21
@@ -267,35 +267,32 @@ function automataPhase(system, frame) {
267267 function drawAutomataCue(ctx, action, cx, cy, cell, colors) {268268 if (!action) return;269269 ctx.save();270- ctx.strokeStyle = colors.TICK;271270 ctx.fillStyle = colors.TICK;272- ctx.lineWidth = Math.max(2, cell * 0.035);273- ctx.lineCap = "round";274271 if (action.action === "wait") {275- const width = cell * 0.16;276- for (const offset of [-width, 0, width]) {272+ const gap = Math.max(1.5, cell * 0.035);273+ const height = Math.max(2, cell * 0.08);274+ for (const offset of [-gap, gap]) {277275 ctx.beginPath();278- ctx.moveTo(cx + offset, cy - cell * 0.11);279- ctx.lineTo(cx + offset, cy + cell * 0.11);280- ctx.stroke();276+ ctx.rect(cx + offset - Math.max(1, cell * 0.012), cy - height / 2, Math.max(2, cell * 0.024), height);277+ ctx.fill();281278 }282279 } else {283280 const dx = action.dx || 0;284281 const dy = action.dy || 0;285- const tipX = cx + dx * cell * 0.2;286- const tipY = cy + dy * cell * 0.2;287- const tailX = cx - dx * cell * 0.14;288- const tailY = cy - dy * cell * 0.14;289- const wingX = dy * cell * 0.1;290- const wingY = dx * cell * 0.1;282+ const size = Math.min(10, cell * 0.13);283+ const tipX = cx + dx * size / 2;284+ const tipY = cy + dy * size / 2;285+ const tailX = cx - dx * size / 2;286+ const tailY = cy - dy * size / 2;287+ const wingX = dy * size / 2;288+ const wingY = dx * size / 2;291289 ctx.beginPath();292290 ctx.moveTo(tailX, tailY);291+ ctx.lineTo(tailX + wingX, tailY + wingY);293292 ctx.lineTo(tipX, tipY);294- ctx.moveTo(tipX, tipY);295- ctx.lineTo(tipX - dx * cell * 0.1 + wingX, tipY - dy * cell * 0.1 + wingY);296- ctx.moveTo(tipX, tipY);297- ctx.lineTo(tipX - dx * cell * 0.1 - wingX, tipY - dy * cell * 0.1 - wingY);298- ctx.stroke();293+ ctx.lineTo(tailX - wingX, tailY - wingY);294+ ctx.closePath();295+ ctx.fill();299296 }300297 ctx.restore();301298 }
@@ -329,8 +326,8 @@ function drawAutomataIndicators(ctx, state, geometry, colors, model, frame) {
329326 drawAutomataCue(330327 ctx,331328 action,332- cellX + geometry.cell * 0.31,333- cellY - geometry.cell * 0.27,329+ cellX,330+ action.action === "wait" ? cellY + geometry.cell * 0.435 : cellY,334331 geometry.cell,335332 colors,336333 );
M src/render/stage-hud.js +4 -4
M tests/board.test.js +20 -0
M tests/stage-hud.test.js +2 -0