You ask for explanation of code? well....
you know when you go to the data/characters file and open up your player .txt and see all that stuff written in there? well this code determines what is written.
Code:
characterfile.write("crystal = ", 0, 7);
characterfile.write(Integer.toString(p.crystal), 0, Integer.toString(p.crystal).length());
characterfile.newLine();
Code:
characterfile.write("crystal = ", 0, 7);
this writes out "crystal = " in the player file without the "" marks.
that is the amount of characters that is inside the first argument
Code:
characterfile.write(Integer.toString(p.crystal), 0, Integer.toString(p.crystal).length());
that puts the value of the crystal next to "crystal = " depending upon what you made it in player.java
Code:
characterfile.newLine();
that just makes the new blank line =]