playerDice = new Dice();
int playerDiceNo = playerDice.getfaceofDie();
MessageBox.Show("Your roll" + playerDiceNo);
compDice = new Dice();
int compDiceNo = compDice.getfaceofDie();
MessageBox.Show("Computers roll:" + compDiceNo);
above is my method for when the roll button is clicked. Below is my dice class:
class Dice
{
private int faceofDie;
public void rollDice()
{
Random rollDice = new Random();
faceofDie = rollDice.Next(1, 7);
}
public int getfaceofDie()
{
return faceofDie;
}
}
I have stated my variables for compDice and playerDice as :
Dice compDice;
Dice playerDice;
I can't seem to figure out why it's returning 0 for both rolls over & over. can anyone help?