Thank you so much for the high scores tutorial! It's fantastic and has helped me out so much. Good advertising for the book too, since after reading and following the tutorial, I've now bought it and am waiting for it to arrive from Amazon.
However, I've had a a problem with the tutorial I was hoping you could help me with.
The first issue I encountered was that if the player's name was shorter than any of the names in the high score file (I'm making a copy of an old C64 game as a present for my mum's birthday, so I've set the PlayerName to "Mum"), the xml file became corrupted. There was leftover text at the end of the xml file (for example, there was usually an extra 'a>' at the end of the file.
I managed to solve this by changing FileMode.OpenorCreate to FileMode.Create, to make sure that the new save file cleared the old data rather than just writing over the top of it.
Having solved that problem, I've hit another and I can't figure out how to solve it.
If the player gets a high score, rather than inserting the player's score in the appropriate place on the high score table and moving everything else down a place, the player's name and score gets copied into the appropriate place and every place below that.
For example, if the player gets the second highest score out of five, the high score table will look like this:
2. Player 1
3. Player 1
4. Player 1
5. Player 1
I haven't the faintest idea why. The only things I've changed from the tutorial is to change PlayerName from "Player1" to "Mum" and FileMode from FileMode.OpenorCreate to FileMode.Create.
Could either of those changes have caused this problem?
Thanks for your help!