Ejemplo n.º 1
0
        private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StreamReader loadFile = new StreamReader("save_game.txt");

            char1.setName(loadFile.ReadLine()); //read and set name

            int loadXP;

            int.TryParse(loadFile.ReadLine(), out loadXP);
            char1.setXP(loadXP);

            int loadHP;

            int.TryParse(loadFile.ReadLine(), out loadHP);
            char1.setHP(loadHP);

            int loadStrength;

            int.TryParse(loadFile.ReadLine(), out loadStrength);
            char1.setStrength(loadStrength);

            loadFile.Close();

            txtPlayerName.Text   = char1.getName();
            txtPlayerHealth.Text = char1.getHP().ToString();
        }