diff options
author | elioat <elioat@tilde.institute> | 2025-01-11 09:46:21 -0500 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2025-01-11 09:46:21 -0500 |
commit | 19cc31cac47903de7fe78ba602eb5693acba5916 (patch) | |
tree | 37b6ed2ea19bf15cfe1decb340a67d1b772ee5a4 | |
parent | 12d8512a41315f93bf7dcc5c9091929e1727a16b (diff) | |
download | tour-19cc31cac47903de7fe78ba602eb5693acba5916.tar.gz |
*
-rw-r--r-- | html/cards/script.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/html/cards/script.js b/html/cards/script.js index 0f2c99a..9d76e24 100644 --- a/html/cards/script.js +++ b/html/cards/script.js @@ -120,6 +120,13 @@ const initializeGame = () => { // Add event listeners canvas.addEventListener('mousedown', handleMouseDown); canvas.addEventListener('contextmenu', e => e.preventDefault()); + + // Add event listener for the 'r' key + document.addEventListener('keydown', e => { + if (e.key === 'r') { + handleResetGame(); + } + }); }; // Event handlers @@ -189,6 +196,13 @@ const handleMouseDown = e => { } }; +// Add this function to handle the reset confirmation +const handleResetGame = () => { + if (confirm("Would you like to reset the cards?")) { + initializeGame(); // Reset the game state + } +}; + // Start the game initializeGame(); |