Trying to create a Yahtzee game and I need help with this JS problem please? via /r/learnprogramming


Trying to create a Yahtzee game and I need help with this JS problem please?

I am trying to build a Yahtzee game in JS. I have five dice generating a random number between one and six every time I click the "Roll Dice" button. However, I want to be able to click on a dice that I want to keep and only re-roll the ones that I have not clicked on.

For Example, let's say I roll three 5's, a 2, and a 4. I want to click on the three dice showing a five, then click roll again, and only have the 2 and 4 dice re-roll. Currently, all of my dice re-roll every time I click my button. How do I stop this from happening? Any advice? Thanks!

Submitted July 16, 2017 at 11:31PM by kingbo5
via reddit http://ift.tt/2uz5QAf

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s