|
-
May 3rd, 2002, 03:03 PM
#1
Thread Starter
Member
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.
-
May 3rd, 2002, 06:47 PM
#2
-
May 3rd, 2002, 07:20 PM
#3
Fanatic Member
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
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
-
May 4th, 2002, 02:48 AM
#4
Frenzied Member
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.
Sanity is a full time job
Puh das war harter Stoff!
-
May 4th, 2002, 04:21 AM
#5
Thread Starter
Member
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.
-
May 4th, 2002, 04:26 AM
#6
Frenzied Member
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.
Sanity is a full time job
Puh das war harter Stoff!
-
May 4th, 2002, 05:27 AM
#7
Hyperactive Member
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.
-Show me on the doll where the music touched you.
-
May 4th, 2002, 06:11 AM
#8
Frenzied Member
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...
Sanity is a full time job
Puh das war harter Stoff!
-
May 4th, 2002, 06:47 AM
#9
Thread Starter
Member
well, my biggest problem is that i dont know where to start. And yes, i do want a table with the top 10.
-
May 4th, 2002, 07:00 AM
#10
Frenzied Member
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...
Sanity is a full time job
Puh das war harter Stoff!
-
May 4th, 2002, 04:39 PM
#11
Thread Starter
Member
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.
-
May 4th, 2002, 06:23 PM
#12
Fanatic Member
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...
Never argue with fools, they will only drag you down to their level, and beat you with experience.
Q: How do you tell an experienced hacker from a novice?
A: The latter thinks there's 1000 bytes in a kilobyte, while the former is sure there's 1024 meters in a kilometer
-
May 4th, 2002, 07:29 PM
#13
Frenzied Member
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...
Sanity is a full time job
Puh das war harter Stoff!
-
May 6th, 2002, 12:43 PM
#14
Thread Starter
Member
alright, thanks for the help.
-
May 6th, 2002, 03:26 PM
#15
Frenzied Member
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...
Sanity is a full time job
Puh das war harter Stoff!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|