From 68e5fce97db818eca1b16d1d1773b2cd1864abba Mon Sep 17 00:00:00 2001 From: kagome Date: Tue, 7 May 2024 16:14:56 +0900 Subject: [PATCH] =?UTF-8?q?=E9=9D=A2=E3=81=8C=E5=A4=89=E3=82=8F=E3=81=A3?= =?UTF-8?q?=E3=81=9F=E3=82=89undo=E3=81=8C=E3=83=AA=E3=82=BB=E3=83=83?= =?UTF-8?q?=E3=83=88=E3=81=95=E3=82=8C=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=99=E3=82=8B=20#22?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/main.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/js/main.js b/js/main.js index 25010da..7ceda1f 100644 --- a/js/main.js +++ b/js/main.js @@ -111,8 +111,6 @@ function update(e) { function undo() { if (moveStack.length > 1) { - systemSound.play(); - moveStack.pop(); playerPosXStack.pop(); playerPosYStack.pop(); @@ -128,7 +126,6 @@ function undo() { } function reset() { - systemSound.play(); moveStack = []; playerPosXStack = []; playerPosYStack = []; @@ -155,18 +152,22 @@ document.getElementById('down-btn').addEventListener('click', () => { // ====================== その他クリックイベント ====================== document.getElementById('undo-btn').addEventListener('click', () => { + systemSound.play(); undo(); }); window.addEventListener('keydown', (e) => { if (e.code == 'Backspace') { + systemSound.play(); undo(); } else if (e.code == 'KeyR') { + systemSound.play(); reset(); } }); document.getElementById('reset-btn').addEventListener('click', () => { + systemSound.play(); reset(); }); @@ -177,6 +178,7 @@ document.getElementById('next-stage-btn').addEventListener('click', () => { currentStage++; stageIndex.textContent = currentStage + 1; init(); + reset(); changeStageSound.play(); } }); @@ -186,6 +188,7 @@ document.getElementById('prev-stage-btn').addEventListener('click', () => { currentStage--; stageIndex.textContent = currentStage + 1; init(); + reset(); changeStageSound.play(); } }); @@ -199,6 +202,7 @@ document.getElementById('clear-next-stage-btn').addEventListener('click', () => currentStage++; stageIndex.textContent = currentStage + 1; init(); + reset(); systemSound.play(); closeClearModal(); }); @@ -217,6 +221,7 @@ document.getElementById('page-title').addEventListener('click', () => { currentStage = 0; stageIndex.textContent = currentStage + 1; init(); + reset(); }); document.getElementById('sound-on-btn').addEventListener('click', () => {