0

I have a problem with this

So I don't understand what's the problem here Whenever I comment out the function that counts the streak of not dying it works normally but whenever the function is working it makes it impossible to die. https://sololearn.com/compiler-playground/WWEZD9jSsAWZ/?ref=app

3rd Jan 2025, 4:53 PM
Pro Gamer 12 Nobody
Pro Gamer 12 Nobody - avatar
10 odpowiedzi
+ 3
Zvi that was basically what I was finding as I was running through his code a few minutes ago https://sololearn.com/compiler-playground/W4H1v81hu9GU/?ref=app
3rd Jan 2025, 6:36 PM
BroFar
BroFar - avatar
+ 2
I think the problem is the in the function btnRouleteYou you are setting a different anonyomous function for the onclick for the button which just makes the number go up but then the first function is lost. I just removed the new function and put your logic straight in to the btnRoulette function and it works as intended. No need for another function. Check it out. https://sololearn.com/compiler-playground/W2Jr94MnE0l1/?ref=app
3rd Jan 2025, 5:57 PM
Zvi
Zvi - avatar
+ 1
BroFar except you went the debugging overkill route in your code🤓.
3rd Jan 2025, 7:02 PM
Zvi
Zvi - avatar
+ 1
Pro Gamer 12 Nobody by the way i like how you are doing this projectone step at a time! I wish I would do things this way🤪
3rd Jan 2025, 7:04 PM
Zvi
Zvi - avatar
+ 1
Zvi I know but I was using his original code following the logic. You took chunks out of code relieving other potential errors.
3rd Jan 2025, 7:19 PM
BroFar
BroFar - avatar
+ 1
Pro Gamer 12 Nobody why not just disable the button when you're dead? // game over mechanic if (RR === 5) { alert("Game Over") document.getElementById("getOut").disabled = true; document.getElementById("life").innerHTML = "You Died"; Ok, this is how I would mod your code: https://sololearn.com/compiler-playground/WbF6wk85v2Mw/?ref=app and going overboard with css and animation: https://sololearn.com/compiler-playground/WtRqcg3sfUgK/?ref=app
4th Jan 2025, 4:02 AM
Bob_Li
Bob_Li - avatar
+ 1
Bob_Li if you are going to take over his code maybe do this for the button instead https://sololearn.com/compiler-playground/WkRqVlPX52qu/?ref=app
4th Jan 2025, 11:59 PM
Zvi
Zvi - avatar
+ 1
Pro Gamer 12 Nobody sorry, I was having too much fun with the code that I did kinda took over it... It was just begging for extra features. ✨ Zvi Yes, that squirt gun emoji rocks! It adds the right touch of fun and color that my ui is lacking. Thumbs up. 👍 Also, it's also thanks to this topic that I finally got to explore the Web Animation API. So it's a win, I think. Maybe it could inspire people to use it for other projects. Surprisingly, it's actually possible to get streaks as long as 20+..
5th Jan 2025, 12:47 AM
Bob_Li
Bob_Li - avatar
+ 1
So I made an update and I want you guys to tell me how I could make it better
5th Jan 2025, 11:42 AM
Pro Gamer 12 Nobody
Pro Gamer 12 Nobody - avatar
0
Pro Gamer 12 Nobody When the player dies, you have to provide a way to continue the game without leaving the game and restarting over again. Always starting at the bottom level is not fun.
5th Jan 2025, 12:08 PM
Bob_Li
Bob_Li - avatar