Rene Nielsen

Rene Nielsen

  • NA
  • 22
  • 31.6k

Help with a class proplem

Oct 28 2010 9:30 AM

ok so i have this projekt where i have this attribute currentField in my class and i define that in my code
 
public void RollDiceAndMove()
{
Dice.Roll();
if (oldField == 0)
oldField = 1;
currentField = oldField;
lastThrow = Dice.GetDices();
currentField = GameBoard.Move(currentField, lastThrow);
oldField = currentField;
}

when i then try in another place to go and get currentField
public string LandedOn()
{
board = GameBoard.GetBoard();
string temp = board[currentField-1];
return temp;
}

then currentField = 1 again even though i gave it a value before. it is probally easier to see what i mean if u get the full projekt
please take a look and help me because i cant seem to find the error that keeps resetting the value of it

Attachment: Matador2.zip

Answers (4)