O'Reilly logo

3D Game Programming for Teens, Second Edition by Eric Grebler, Maneesh Sethi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding and Positioning Text

Adding and positioning text in your games can all be done with one line of code, simply called the Text command. When you enter the Text command, you specify what text is to be included, where it is to be positioned, and how it should be justified. Here is an example of a line of code that will create a line of text that says “Your Score Is:”:

Text 100,20, "Your Score Is: ",True,False

If you positioned this text in the right location and then ran the program, you should get the same result as seen in Figure 13.7.

Figure 13.7. Entering the code to create the text above is simply a matter of using the Text command.

Now let’s dissect the code we created to see how we created this text:

Text 100,20,—The word Text ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required