Results 1 to 15 of 15

Thread: High Score

  1. #1

    Thread Starter
    Member insaneman's Avatar
    Join Date
    Oct 2001
    Posts
    63

    Angry 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.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

  3. #3
    Fanatic Member McCain's Avatar
    Join Date
    Jan 2002
    Location
    Sweden/Denmark
    Posts
    802
    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

  4. #4
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    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!

  5. #5

    Thread Starter
    Member insaneman's Avatar
    Join Date
    Oct 2001
    Posts
    63
    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.

  6. #6
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    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!

  7. #7
    Hyperactive Member Ambivalentiowa's Avatar
    Join Date
    Apr 2002
    Location
    Coming soon to a store near you!
    Posts
    375
    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.

  8. #8
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    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!

  9. #9

    Thread Starter
    Member insaneman's Avatar
    Join Date
    Oct 2001
    Posts
    63
    well, my biggest problem is that i dont know where to start. And yes, i do want a table with the top 10.

  10. #10
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    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!

  11. #11

    Thread Starter
    Member insaneman's Avatar
    Join Date
    Oct 2001
    Posts
    63
    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.

  12. #12
    Fanatic Member McCain's Avatar
    Join Date
    Jan 2002
    Location
    Sweden/Denmark
    Posts
    802
    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

  13. #13
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    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!

  14. #14

    Thread Starter
    Member insaneman's Avatar
    Join Date
    Oct 2001
    Posts
    63
    alright, thanks for the help.

  15. #15
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    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
  •  



Click Here to Expand Forum to Full Width