Skip to content

Commit

Permalink
undo button
Browse files Browse the repository at this point in the history
  • Loading branch information
rnickles committed Oct 8, 2024
1 parent 1521cf5 commit a280fe4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions _layouts/level.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
top: 10px;
right: 10px;
padding: 10px 20px;
font-size: 16px;
font-size: 32px;
z-index: 1001;
background-color: #007bff;
color: white;
Expand All @@ -59,7 +59,7 @@
top: 70px;
right: 10px;
padding: 10px 20px;
font-size: 16px;
font-size: 32px;
z-index: 1001;
background-color: #007bff;
color: white;
Expand Down
12 changes: 7 additions & 5 deletions game/acceptUserInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export function acceptUserInput(engine, render, gameState) {
}
}

let undoButton = document.getElementById('undo-button');
function holdit() {
function setupUndoButton() {
let undoButton = document.getElementById('undo-button');
let t;
let start = 100;
let speedup = 1.05;
Expand All @@ -69,11 +69,13 @@ export function acceptUserInput(engine, render, gameState) {
}

undoButton.onmouseup = function () {
start = 100;
speedup = 1.05;
clearTimeout(t);
}
};
undoButton.onclick = holdit;// undo button

}

setupUndoButton();

function onActiveSlingshot(mousePosition) {
// Define a small region around the mouse
Expand Down

0 comments on commit a280fe4

Please sign in to comment.