+ 1

timer again...

i dont even know why im strugglin with this but how do u make the timer count down https://www.sololearn.com/compiler-playground/WoBqea8q53lj

28th Oct 2022, 4:26 PM
Junior
Junior - avatar
23 Answers
+ 2
Outlining such a plan for a project is very helpful, isn't it? Your code looks really good now. I have answered your questions where I have changed something. https://code.sololearn.com/WtX6fSaAkjkR/?ref=app
4th Nov 2022, 11:57 PM
JaScript
JaScript - avatar
+ 1
JaScript do u knwow how make my array of questions appear, ik i have to add some timer so it switches but how do i make it the text atleast not say undefined https://www.sololearn.com/compiler-playground/WoBqea8q53lj
28th Oct 2022, 10:03 PM
Junior
Junior - avatar
+ 1
By the way Your Mom , I recommend a different approach. - Generate two numbers - Generate one operator - etc.
29th Oct 2022, 11:51 AM
JaScript
JaScript - avatar
+ 1
Its not rlly a big deal, but do you know how i can space my numbers out, for example, this is how it is right now: 5+5. how i want it: 5 + 5. i tried adding a " " in my document for my operator but its still not working https://www.sololearn.com/compiler-playground/WoBqea8q53lj
29th Oct 2022, 3:05 PM
Junior
Junior - avatar
+ 1
so, now im trying to make it so it checks if the answer is correct i added a submit button but it doesnt seem to be working. theres an error saying that submit is not a function, i put the submit inside the start() function but idk if it would also work if i put the submit not inside the start() function https://www.sololearn.com/compiler-playground/WoBqea8q53lj
30th Oct 2022, 4:36 PM
Junior
Junior - avatar
+ 1
JaScript thx, but why do u for the switch statement put operators[randomOP]
31st Oct 2022, 12:04 AM
Junior
Junior - avatar
+ 1
Operator is randomly selected from the array. This is only its character. With switch is determined its function and finally the actual result of the task.
31st Oct 2022, 6:54 AM
JaScript
JaScript - avatar
+ 1
So now, im trying to add lives into it, ik it doesnt look the best ill fix that but for now there just little squares, so when u get one wrong it takes a life away and it works, except it also takes a life away for when u get it right. Another problem is how do i make it so when u have 0 lives it makes u restart idk why i just cant think of this. I tried adding back the document.getElementById("ready") but then it just turns into a blank screen when u click it after u lose all ur lives https://www.sololearn.com/compiler-playground/WoBqea8q53lj
31st Oct 2022, 10:07 PM
Junior
Junior - avatar
+ 1
So i tried using ur code, i cant figure out what to put in the "if" statement though when the lives reach 0, i couldnt find any if statement that looked similar to mine or made it restart rlly https://www.sololearn.com/compiler-playground/WoBqea8q53lj
2nd Nov 2022, 12:00 AM
Junior
Junior - avatar
+ 1
k so i added back my wrong as what u put as "collisions", i think i did it right, i looked through your codea dn ur ifs. its still not displaying the "click tor start" button tho. Do i need to add thre functions like u said or is it smth else. It is giving me an error about my remove for rthe removeLive() function. https://www.sololearn.com/compiler-playground/WoBqea8q53lj
2nd Nov 2022, 11:33 PM
Junior
Junior - avatar
+ 1
Your test if(wrong < 1) … is never called. If you remove live and you don‘t have any then comming the error. The best method is to write what should the code do and when. With paper and pencil. After that it will be more easier to code. Here a image with beginning of that what I mean: https://dl.dropbox.com/s/tz3qo31payo37f8/Algorithm.001.jpeg?raw=1
3rd Nov 2022, 4:44 PM
JaScript
JaScript - avatar
+ 1
so, i added more functions like your said before, idk if this is how you want it, i can change it back if ya want but ye. Im not rlly understanding what u mean, i did look at the picture but I still dont rlly know what to do with my lives. I dont rlly understand the "do and when" part u said, i put in my else which im guessing is stating: when time is < 0 and my answer for my input is not correct i want it to do these things and take a life away. Yes I do get the part for when theres no children left for the lives but i just dont know how to fix it https://www.sololearn.com/compiler-playground/WoBqea8q53lj
4th Nov 2022, 10:33 PM
Junior
Junior - avatar
+ 1
So, im trying to add this animation, so basically when u hold down the button i want my box-shadow to go away, and when u release it comes back up. U can look at my fucntion shadow() to show u what i mean, the problem is it only works once. but another thing is how would i make a resatrt button work. So, when u reach 0 lives it will pop up with the ready button as it does in the start, but it seems thta it doesnt work it just does a blank screen, when i just want it to restart the whole thing https://www.sololearn.com/compiler-playground/WoBqea8q53lj
5th Nov 2022, 11:58 PM
Junior
Junior - avatar
+ 1
The idea how to change a shadow of a button in this way is ok, but the css with javascript don‘t so work and all depends from used browser too. In addition a part of people work with touch screen devices. To find out a solution which good works you need to develop and test some different ways. More to this in the code. To restart the whole thing you have to as you said yourself, after you reach 0 lives, to set all elements to the state as in the begining of game. For it I would recommend you to repeat the css tutorial or close additional one more for example with responsive design etc. Because there will be needed more structure in the design of the page. Now a few elements i do not see because they are out of window. For this reason I used the previous code to show the way for shadow: https://code.sololearn.com/WuRF2E01WSME/?ref=app
6th Nov 2022, 2:02 PM
JaScript
JaScript - avatar
+ 1
hold up, k, so why is there no variable for bs2. for bs1 it says, let bs1 = …, but for bs2 it just says: bs2 = … it has not let or var thing in it
6th Nov 2022, 11:08 PM
Junior
Junior - avatar
+ 1
There is a coma after the bs1 variable declaration, therefore the second belongs to the same „let“.
6th Nov 2022, 11:41 PM
JaScript
JaScript - avatar
+ 1
ahh yes i didnt see that, ty
7th Nov 2022, 12:08 AM
Junior
Junior - avatar
+ 1
I didnt test that yet on a PC, does work the shadow() with onload (it’s important) on your PC?
7th Nov 2022, 12:15 AM
JaScript
JaScript - avatar
+ 1
no, anyway to fix that?
7th Nov 2022, 3:07 PM
Junior
Junior - avatar
+ 1
im using google as browser
7th Nov 2022, 3:08 PM
Junior
Junior - avatar