-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added a modal allowing the player to choose the level and a start gam… #21
base: main
Are you sure you want to change the base?
Changes from 1 commit
ec148c7
fea1808
7cf40a1
ab28af1
834eb60
8d58653
baf485c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,19 +123,31 @@ window.onclick = (e) => { | |
closeModal(); | ||
} | ||
}; | ||
|
||
function closeModal() { | ||
modal.classList.remove("active"); | ||
shadow.classList.remove("active"); | ||
let counter = 0; | ||
function handleLevel(string) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use better parameter name, like level instead of string 🤣 |
||
{ | ||
if(string==='Easy') | ||
timerStart(); | ||
else if(string==='Medium') | ||
timerStart(); | ||
else if(string==='Hard') | ||
timerStart(); | ||
|
||
} | ||
function timerStart(){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as I suggested in my previous comment, do not make this a separate function, there is this anonymous function just change it to a named function, and then instead of calling the timerStart(), call that function passing the level to it. The timer logic was already there in that function There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not working when I'm doing this idk why :( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Made changes ! |
||
let counter = 0; | ||
const interval = setInterval(function(){ | ||
counter++; | ||
console.log() | ||
timer.innerHTML = "<b>" + counter + "</b>"; | ||
}, 1000); | ||
setInterval(); | ||
} | ||
|
||
function closeModal() { | ||
modal.classList.remove("active"); | ||
shadow.classList.remove("active"); | ||
} | ||
function hideButton(){ | ||
document.getElementById('hide').style.display ="none"; | ||
} | ||
function openModal() { | ||
modal.classList.add("active"); | ||
shadow.classList.add("active"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hide is not a better name, try something like start-btn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the name from string to level