Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Can anybody help me with a highscore board please?

Author
Message
Colonel Cool
19
Years of Service
User Offline
Joined: 3rd Aug 2005
Location: Somewhere
Posted: 20th Aug 2005 02:46
I'm sorry for when I didn't fully appreciate the help I got it was only because I was frustrated and stuff. I'm going back to starting small can anyone help me with a highscore board for my Break-Out clone game?

Formerly Ogre Software
My Current Project: Mystic I: Quest of A Lifetime
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 20th Aug 2005 04:44 Edited at: 20th Aug 2005 04:45
No problem.

One way is to have a multi-dimensioned string array variable:

Dim HiScore$(9,1)

This creates a variable which will store 20 string items. You can store 10 player names for the hiscore table in the first subscript (using ,0) and 10 scores in the second subscript (using ,1).

This sounds complicated, but it will make sense when you see this:

Hiscore$(0,0) = "Tom"
Hiscore$(1,0) = "Steve"
Hiscore$(2,0) = "Alice"

and so on to...

Hiscore$(9,0) = "Freddy"

Space for ten names OK?

All you do when a game is finished is look at the players score and see if it's better than the last score on the hiscore table (array position 9).

If it is, then ask for their name. (You already know their score).

If say they have the fifth highest score, then they go into the table at position 4 (remember we are storing scores from 0 to 9 - not 1 to 10).

The scores are stored in the same way as the names, but using the subscript 1:

Hiscore$(0,1) = Str$(Score)
Hiscore$(2,1) = Str$(Score)
Hiscore$(3,1) = Str$(Score) ... and so on.

So, if our player (let's say it's "Some Guy") scored 25000 and that got you on the table at 3rd position we would use:

Input "Made The HiScore Table! Enter Your Name: ";Name$
Hiscore$(2,0) = Name$
Hiscore$(2,1) = Str$(Score)

When you display the HiScore table on the screen, you simply do it in a For..Next loop from 0 to 9, printing subscript 0 and 1 on the same line. Eg:



For example, at any time, Hiscore$(6,0) will contain the name of the seventh name on the list and Hiscore$(6,1) will contain the seventh name's score.

The hardest bit is figuring out where on the table the current score should go...

Assuming that your players score is stored in the variable 'Score', you do the following:



(Hope this works - typing it straight into the box from memory)!

What this does is check to see if the current score is good enough to get on the table. If it is, it runs through the array to find out what position it made.

It then moves all the scores down one position starting at the position the new score has to be slotted in. (The last one falls off the end).

Finally, it slots the new name and score in at the new position.

This should work OK, but if I have made any small errors, it should still give you the general idea of how to make a hiscore table in your game!

TDK_Man

Colonel Cool
19
Years of Service
User Offline
Joined: 3rd Aug 2005
Location: Somewhere
Posted: 20th Aug 2005 15:23
Thanks TDK this is going to help me alot.

Back 2 Programming!

Formerly Ogre Software
My Current Project: Mystic I: Quest of A Lifetime
CaMeRoN H
19
Years of Service
User Offline
Joined: 21st Aug 2005
Location: Who knows?
Posted: 22nd Aug 2005 05:15
i was wondering like what is the easiest game programming language to learn after Gamemaker?>

Login to post a reply

Server time is: 2024-11-27 18:41:25
Your offset time is: 2024-11-27 18:41:25