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
10 Answers
+ 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
+ 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
+ 1
BroFar except you went the debugging overkill route in your codeđ€.
+ 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đ€Ș
+ 1
Zvi I know but I was using his original code following the logic. You took chunks out of code relieving other potential errors.
+ 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
+ 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
+ 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+..
+ 1
So I made an update and I want you guys to tell me how I could make it better
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.