Hello,
i have a simple pong game.
i inserted a counting which does +1 when the ball hits the paddle. and i show this on screen. this works
i also already have code that exits the game when the ball misses the paddle
But now i want to save highscore.
This is precisely what i want:
- when game is over, save highscore
- only overwrite it when it's higher than the previous
- load it when game starts
just very simple, only a number. No table or best 10 or something, just 1 number that only overwrites when its higher the the previous.
thanks in advance
Rick
Loading
Javeed M ShaikhPosted Oct 29, 2011, 8:37 PM
http://xnaessentials.com/tutorials/highscores.aspx/tutorials/highscores.aspx
Rick van LeeuwenPosted Oct 29, 2011, 6:10 PM
i just need simple instructions:
- make the XML
- save a variable to the XML
- load variable form XML
Thanks
Javeed M ShaikhPosted Oct 26, 2011, 8:43 PM
Rick van LeeuwenPosted Oct 26, 2011, 5:34 PM
or am i looking in the wrong window?
Javeed M ShaikhPosted Oct 26, 2011, 5:22 PM
1. Right Click on the project, click properties.
2. Click on Settings tab on the left, this will open grid on the right hand side. Here you need to enter name of the setting (topscore), type(string), scope(User) and Value(0).
3. you can later access this settings from C# code like below.
Properties.Settings.Default.topscore;
you can save new score to this setting like below:
Properties.Settings.Default.topscore= mtopScore;
Properties.Settings.Default.Save();
Rick van LeeuwenPosted Oct 26, 2011, 5:10 PM
Javeed M ShaikhPosted Oct 26, 2011, 5:09 PM