From 5524e62aa9197158dbcd4d3830473c48a7a4df9a Mon Sep 17 00:00:00 2001 From: GGod <46885632+GGodPL@users.noreply.github.com> Date: Sat, 30 Dec 2023 22:16:18 +0100 Subject: [PATCH] add chessjs tutorial --- mods/chess.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mods/chess.js b/mods/chess.js index 88cd0832..c5d1d0d6 100644 --- a/mods/chess.js +++ b/mods/chess.js @@ -1433,19 +1433,26 @@ function cellTick() { } } +runAfterLoadList.push(() => { + if (!localStorage.getItem("chessjs-tutorial")) { + // "might break" + // i know damn well it will 100% break on mobile + alert("To start or restart chess board press 'u'. Might break on different resolutions and on mobile."); + localStorage.setItem("chessjs-tutorial", true); + } +}) + window.addEventListener("keydown", (ev) => { if (ev.key == "u") { if (!running) { - videoFrame = 0; - for (let i = offsetX; i < width - offsetX; i++) { for (let j = offsetY; j < height - offsetY; j++) { if (pixelMap[i][j]) deletePixel(i, j); createPixel("screen", i, j); } } + running = true; } - running = !running; game.resetBoard(); } else { game.onKey(ev); @@ -1455,4 +1462,4 @@ window.addEventListener("keydown", (ev) => { window.addEventListener("mousedown", (ev) => { game.onMouseClick(ev); }) -} +} \ No newline at end of file