Hello guys (and girls).
I've got a problem in my Yahtzee project, where I've tried to search all over the internet, but haven't found a solution to my problem.
My basic problem is, that I have a random that generates my (1,7) numbers (for each dice number(1,2,3,4,5,6)) over my 6 dices that I have in the game.
I've made a "HOLD" Button which is supposed to hold my generated random dice number (it's a button with a picture on it on my Form), but I can't seem to make it work.
How can I certify that when I press the "hold" button and then click "ROLL DICES" once more, that it doesn't change my holded dice and starts generating a new number??
By the way I'm not that experienced in C# so please try and help me in a noobie language :-)
I will appreciate any sorts of help to the bottom of my heart!
Best Regards,
Rasmus Christensen
Loading
Rasmus ChristensenPosted May 8, 2012, 5:09 AM
I will return shortly if I can :).
FroglegPosted May 8, 2012, 4:35 AM
On the first go you roll all the dice
After this the player can hold any number of dice and roll again
This can be done a third time, then the game returns to rolling all dice
The whole process is repeated 13 times and a score of all the dice rolls is displayed
In code you can create 5 booleans in an array or whatever
When you click hold1 button, bool number1 = true
You will also have to sort a way of setting the dice throw sequence - again with a bool
IE: bool initialThrow, secondThrow, and thirdThrow
When you loop through your random picking code - use an if statement
IE
if (initialThrow) do whatever and so on
See how you go doing it yourself
Rasmus ChristensenPosted May 8, 2012, 1:22 AM
I've been experimenting abit with arrays, just can't seem to make em work though.
Well I'm guessing that you know the rules of Yatzi.
When I've saved my dicevalues into arrays, how do I prevent the exact dice to not get rolled once again? That's kind of where I get lost :-)
Thanks in advance,
Best Regards,
Rasmus Christensen
FroglegPosted May 7, 2012, 4:35 PM
int[] diceValue = new int[6];
Dice values will be
diceValue[0] = first random
diceValue[1] = second random etc
Note -Arrays start at 0, so for six dice it will be diceValue[0] to diceValue[5]