i have a small problem with my text-based RPG in c# console.
I have made a method to save and that works but when i want to load it gives me an error..
here is my code for loading :
(the strings don't give a error but the problems start from Level to Agility)
code :
public static void LoadData ()
{
// create reader & open file
TextReader tr = new StreamReader("SavedGame.txt");
// read lines of text
string xCoordString = tr.ReadLine();
string yCoordInt= tr.ReadLine();
//Convert the strings to int
Name = Convert.ToString(xCoordString);
PlayerType = Convert.ToString (xCoordString);
Level = Convert.ToString(xCoordString);
HP = Convert.ToInt32(yCoordInt);
Strenght = Convert.ToInt32(yCoordInt);
Intelligence = Convert.ToInt32(yCoordInt);
Agility = Convert.ToInt32(yCoordInt);
// close the stream
tr.Close();
}