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 / Highscores

Author
Message
n008
17
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 27th Apr 2007 05:17
How would one add a highscores table to a game?

Ling creckt tsi nocreckto havela? NASA chetallnar mo lu'ul nasding!
Lucy
17
Years of Service
User Offline
Joined: 19th Apr 2007
Location: Roanoke, VA USA
Posted: 27th Apr 2007 05:32 Edited at: 27th Apr 2007 05:39
This will reset when you restart the game. If you want to have it save them, you'll have to work out a way to dump the data to a file.

this code will generate a basic top ten high score table



This code is a function to print out the high score table


then any time you want to print the high scores, just run "printhighscores()"

I'm a little too sleepy right now to actually bother writing code to go through, sort through the array and find the place to insert the new high score and filter bump out the lowest one.

I can say this much though, the logic is roughly the same as setting the high score, it just involves checking to the current score against the scores in the list to find out which one it's greater than, bump all the ones from that one and on downward, and replace it.

To do a quick little check, you can check the current score against the lowest one (which would be like highscore(9))... if it's greater than highscore(9) then obviously it belongs in the list somewhere.

No matter where you are... everyone is always connected.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 27th Apr 2007 19:46
Hiscore tables are covered in tutorial 7 - Everything You Wanted To Know About Strings - here:

http://forum.thegamecreators.com/?m=forum_view&t=99497&b=10

It's for DBC, but the theory is the same for DBPro - you can use the supplied code snippet as it is, or alter it to use Types as Lucy showed you.

TDK_Man

Login to post a reply

Server time is: 2024-11-25 19:20:44
Your offset time is: 2024-11-25 19:20:44