+ 1
Rock Paper Scissors game Help.
Iām trying to make Rock Paper Scissors game, and before I go any further, I need help taking care of this problem. JS/ The go_btn is the button that says āROCKā. This is how the game goes. You click āROCKā, and then at the bottom the emojis say Paper Scissors Shoot (with rotating motion). On shoot you have to pick your weapon (the three emojis at the top). But the āROCKā button is causing problems. The more you click on it, the score keeps adding more than one (+1, +1, +2, +3...) Iām not sure how to... https://code.sololearn.com/Wo4uSXbgnm5T/?ref=app
10 Answers
+ 1
the reason is that your rock, paper, scissors add event listener in play()
so when player clicked go_btn, it adds the event listener multiple times, so after say 3 clicks of go_btn, one click of paper will become playing paper for three times.
solution is to take those three addEventListener out of play(), a good place is below go_btn addEventListener
+ 1
default display none
in play(), set style.display
+ 1
use random syntax
0
I didnāt finish my thought:
Iām not even sure how we would fix that. I feel like Iām expecting too much.
0
Gordon Yeah, I could pit it outside, but
I want it to be like...
You canāt press on the options (rock, paper, sciss..), befoe clicking the āROCKā button.
have to click on āROCKā everytime before it you can click on the options (rock, paper, sc...)
0
Gordon , display the buttons, none| block, when āROCKā clicked?
0
yes, in css, display none
in button event listener, set their style.display block (or other appropriate value)
0
Check this men
https://code.sololearn.com/cgDhpLufWanI/?ref=app
0
https://code.sololearn.com/ccHdhgoKlLtV/?ref=app
It can help you
0
Leandro Blandi , Anay Sah :
i kind of know how to do that, but this is a little different.
..