Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub CheckForNewHighScore()
- '------------------------------------------------------------------------------------------------------------------
- ' Purpose: Check to see if player's score has beaten any of the top 5 scores, prompt player for their name if so
- '------------------------------------------------------------------------------------------------------------------
- Dim i As Integer = 0
- Dim j As Integer = 0
- '0 = 1 pos , 4 lowest
- If Score > Top5PlayerScore(4) Then
- ' timeBeginPeriod(0)
- Dim showdialog As New frmNameEntry
- ' Get the position in Table
- For i = 4 To 0 Step -1
- If Score > Top5PlayerScore(i) Then
- j += 1
- End If
- Next
- j = 5 - j
- ' Prompt player for their name
- If showdialog.ShowDialog() = Windows.Forms.DialogResult.OK Then
- ' Sort table
- If j < 4 Then
- For i = 4 To (j + 1) Step -1
- Top5PlayerName(i) = Top5PlayerName(i - 1)
- Top5PlayerScore(i) = Top5PlayerScore(i - 1)
- Next
- End If
- Top5PlayerName(j) = PlayerName
- Top5PlayerScore(j) = Score
- ' Add new player
- SaveHighScores()
- End If
- End If
- AppRunning = False
- MainLoop()
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement