7
Answers

Simple highscore

Photo of Rick van Leeuwen

Rick van Leeuwen

13y
4.4k
1
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

Answers (7)

0
Photo of Javeed M Shaikh
NA 7.8k 69.7k 13y
0
Photo of Rick van Leeuwen
NA 37 10.8k 13y
Ok, and how do i do that:P?
i just need simple instructions:

- make the XML
- save a variable to the XML
- load variable form XML


Thanks
0
Photo of Javeed M Shaikh
NA 7.8k 69.7k 13y
I am sorry, I did not realize that it is an XNA Studio Game Solution. I have little knowledge about this so my guess is you have to use external storage of xml file or any other format. 
0
Photo of Rick van Leeuwen
NA 37 10.8k 13y
in the properties i dont see settings, only this:
or am i looking in the wrong window?

0
Photo of Javeed M Shaikh
NA 7.8k 69.7k 13y
Open you project in your IDE follow these steps:

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();
0
Photo of Rick van Leeuwen
NA 37 10.8k 13y
How? :)
0
Photo of Javeed M Shaikh
NA 7.8k 69.7k 13y
you can store it in the project settings file.