Maybe something like this?
*EDIT* saving and loading are left for you to implement yourself
*EDIT* saving and loading are left for you to implement yourself
Graphics 800,600,16,2 SetBuffer BackBuffer() Type HighScores ;Create a Type with two arrays to store the high scores Field Name$[9] Field Score%[9] End Type Type Player ;Create a player type to hold the player's details Field Name$ Field Score% Field ScorePosition% End Type Global CurrentPlayer.Player = New Player ;Create an instance of the Player type CurrentPlayer\Name$ = "" CurrentPlayer\Score% = 0 CurrentPlayer\ScorePosition% = -1 ; initialize it to a number lower than the table allows Global HighScoreTable.HighScores = New HighScores ;Create an instance of the highscore type LoadHighScores() CurrentPlayer\Score% = 50000 ;for test purposes, set to highest score ;BEGIN MAIN LOOP While Not KeyDown(1) ;Play the game Text 10,10,"game is running Wow! isn't it fun?!?! - press escape to quit" Flip Cls Wend ;END MAIN LOOP CurrentPlayer\ScorePosition%= GetScorePosition(CurrentPlayer\Score%) If CurrentPlayer\ScorePosition% > -1 Then ;if the score has a position on the board CurrentPlayer\Name$ = Input$("Congratulations! Enter Your Name: ") AddScore(CurrentPlayer\Score%, CurrentPlayer\Name$, CurrentPlayer\ScorePosition%) EndIf SaveHighScores() While Not KeyDown(1) ;Display the score table For t = 0 To 9 If t = CurrentPlayer\ScorePosition% Then Color 255,0,0 Else Color 255,255,255 EndIf Text 50, 50 + (t*16), HighScoreTable\Name$[t] Text 150, 50 + (t*16), ""+HighScoreTable\Score%[t] Next Flip Cls Wend End ;END OF PROGRAM Function LoadHighScores() ;Load the high scores from file ;create a default high score table for demonstration purposes ;0 is the bottom of the table, 9 is the top For t = 0 To 9 HighScoreTable\Name$[t] = "Player " + t HighScoreTable\Score%[t] = (t*1000) + 1000 Next End Function Function SaveHighScores() ;save the highscores to file End Function Function AddScore(Score%, Name$, Position%) For t = 0 To Position-1 If t = Position Then HighScoreTable\Score%[t] = HighScoreTable\Score[t+1] HighScoreTable\Name$[t] = HighScoreTable\Name$[t+1] EndIf Next HighScoreTable\Score%[Position] = Score% HighScoreTable\Name$[Position] = Name$ End Function Function GetScorePosition%(Score%) Local Position% For t = 0 To 9 If Score > HighScoreTable\Score[t] Then Position = t Next Return Position End Function