-
High Score
me and my friend have developed a game and now I am trying to insert a high score system, where a bigger score is better, we already made a score system. I read an article on high scores, but it didnt help much. If anyone could help me here, then thanks.
-
-
Or if you wanna keep it really simple you could just use labels to display the scores and save them to a file using Put and Get - it'll take you maybe five minutes to code and is a little harder to edit then if you just save it to a txt file
-
the easiest way to sort them would be to add them all to a listbox, which needs to have sort=true and does not need to be visible. If you've played just add the new score to the listbox and show the first ten with lables or however you plan on doing it. For saving you can now just loop from index 0 to index 9 (or 1 to 10 I don't know if it was zerobased or onebased, just try) and write them to a textfile or with put and get since anyone could open your textfile with notepad and change the highscore.
well I I could help you a little.
-
is there anywhere that i can learn to make the sort of High Score as Hack and /\/\isan are talking about? since i am kind of a beginner.
-
well I would start with learning by doing.
Right now I don't have any code in my head that would give me the complete thing. Just open up your VB and start playing around in an independent project. Once you got it you can start implementing it. That way the code wil be cleaner since you have to do it two times. It's a good way if you have no clue how it should look at the end.
-
Or you could just make a text file that holds the current high score. Then get the high score from the file and if the current score is higher, put it in the text file.
-
well that only works if you want to keep one single highscore
most likely he wants a table of like the 10 best scores.
so insaneman don't you think you can start with the advice you got? If not ask a little more specific where your problem is, I am not gonna write the whole code for you but you can always ask when you run into some trouble...
-
well, my biggest problem is that i dont know where to start. And yes, i do want a table with the top 10.
-
alright I guess it does not matter where to start but let me think how I would do it
well first I would make the design.. let's say its 10 labels.
Than I would make two functions. One saving 10 names + Their score and one for loading. I think I UDT will do best it could be something like
Type tScore
name as string
Score as long
end type
and than declare an array with ten elements of it
than you should load and save that array with get and put.
next I would write the function to show all the entries of the array in the right order... as I said you could add them to a listbox that does the sorting for you and than just pick them out again sorted...
than you can do whatever you want with your scoretable...
-
Well, i have made a form that can get the codes and place them in the right order and everything. My only problem now is storing the high scores after i leave the game, and loading them when i start the game again, i need some help with this.
The form that i made is just 10 labels, 5 with names, 5 with the score, then i did some simple coding to make it go in the right order.
-
Check out http://www.vbworld.com/files/openstatement/ for a tutorial on writing and reading to/from files. I would - as I've already said - use put/get...
-
just open a file as binary and than "put" all the variables in the right order and "get" them again in the same order. The MSDN will help on details...
-
alright, thanks for the help.
-
well I hope it works for you.. if not I just posted the code for it in the thread
http://www.vbforums.com/showthread.p...7&goto=newpost
well if you need more information...