January 21, 2021
Hot Topics:

Using Graphics: Making a Lander Game - Part 3

  • By John Percival
  • Send Email »
  • More Articles »

This function returns a string containing the table, with the three columns, position, score and name separated by tabs. There is an optional parameter, BiggestScore, that allows only part of the table to be printed. If this is not specified, then the whole table is printed:

Public Function MakeScores(Optional BiggestScore As Integer) _
  As String
Dim makescore As Integer
If BiggestScore > numberplaces Or IsEmpty(BiggestScore) = _
  True Or BiggestScore = 0 Then BiggestScore = numberplaces
MakeScores = IIf(ScoreOrder = BiggerIsBetter, "Bigger", _
  "Smaller") & " is better" & vbNewLine & "Position" & vbTab _
  & "Score" & vbTab & "Name" & vbNewLine & String(60, "-")
For makescore = 1 To BiggestScore
MakeScores = MakeScores & vbNewLine & makescore & ")" & _
  vbTab & Scores(makescore).intScore & vbTab & _
End Function

The code is a lot easier to read all on one line, so load up VB, and all will be revealed.

Well, this is the end of my development of the Lander game. As usual, you can check out the demo to accompany this article. I hope you have gained some knowledge about programming a simple game in VB, and will continue to add features to the program.

If you have any questions or comments, you can post them in the feedback system below, or in the Q and A forum.

Page 6 of 6

This article was originally published on November 20, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date