Greetings Everyone
How are you all today? good I hope =)
this is my first post here so ill try to explain the best i can
here’s what I’m trying to do, I’m working on a monopoly game for my school’s final project and so far things are going smooth, but I’m having a little problem on the dice stytem
so far this is my code:
function Update () {
var dice1:int = Random.Range(1, 7);
var dice2:int = Random.Range(1, 7);
var diceResult = dice1 + dice2;
var playTimes:int = 0;
var playAgainTimes:int = 0;
var playAgain=false;
if(Input.GetButtonUp(“Jump”))
{
playTimes = diceResult;
Debug.Log(playTimes);
if(dice1 == dice2){
playAgainTimes +=1;
Debug.Log("play again = " + playAgainTimes);
if(playAgainTimes == 3){
Debug.Log(“Jail Time”);
}else if(dice1 != dice2){
playAgainTimes=0;
Debug.Log("the number is " + playAgainTimes);
}
}
}
}
well so far i managed to do a random number generator and checking if the number of the dices where the same, and that would add a turn, if the turns where equal to 3 then the piece would go to jail, but the problem is, every time the dices are equal to each other more than 2 times , the var playAgainTimes is always equals to 1.
here’s a picture of it:
so what’s wrong?
I’m sorry but I’m still a little fresh on uniscript, i know a bit of javascript(still learning ^^)
I thank you all in advance for your time and thank you for helping me ^^