Skip to content

Commit

Permalink
Update app.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-X-69 committed Jan 6, 2025
1 parent a81d8d0 commit 7d14761
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ let isGoingRight = true
let direction = 1
let results = 0
let won = false
let cooldown = 300
let lastShot = new Date("2069-01-06T12:00:00");
let currentShot

for (let i = 0; i < width * width; i++) {
const square = document.createElement("div")
Expand Down Expand Up @@ -189,7 +192,11 @@ function shoot(e) {
}

if (e.key === " " && init<100) {
laserId = setInterval(moveLaser, 100)
currentShot = Date.now()
// if(lastShot - currentShot >= cooldown){
laserId = setInterval(moveLaser, 100)
lastShot = currentShot
// }
}
}

Expand Down Expand Up @@ -224,8 +231,8 @@ function shitCounter(){
if(init<=100 && !won){
timer.innerHTML = `Amount of Shit on Statue: ${init}%`
init++
}
else resultDisplay.innerHTML = "YOU LOST"
} else if(won) resultDisplay.innerHTML = "YOU WON"
else if(!won) resultDisplay.innerHTML = "YOU WON"

if(init>=10 && init<20){
grid.classList.remove("grid")
Expand Down

0 comments on commit 7d14761

Please sign in to comment.