Blending OnlineGames and Tutorials on the Blender Game Engine |
|||
|
Home
Blender Games Tutorials Resources
|
Using Text in the Game EngineDisplaying and manipulating text in Blender's game engine isn't quite as simple as you would expect. Here I'll outline the basic methods for adding dynamic text to your Blender games. Arial Front (15.5KB) | ftblender (123KB) Each line of text will require a separate plane, so to begin with let's add a plane.
Next you'll need a font image for the text. Download the Arial font above, or you can use an alternative if you have one ready. To create your own custom fonts in Blender from .ttf files, you can use ftblender. Assign this texture to the plane using the UV editor. Next you need to map the UV coordinates of the plane to surround the "@" symbol in the upper left corner like so:
Your plane should now look like this (in textured view):
Alter the face settings of the plane to the following:
Now, go to the Logic Section (F4) and add a property to the plane called Text. You can set this to a string type if you only want to display some text, or an integer if you want to display a health count for example:
If all went well you should now have text displayed on the screen. It may be pointing in the wrong direction, or the letters may be rotated incorrectly. You can fix this by rotating the plane and/or rotating the UV mapping of it. If the text is mirrored the wrong way around, you may need to flip the normals of the plane. You may find that the letters have a large amount of space between them, or are too closely packed together:
To fix this problem scale the plane in edit mode either larger or smaller. Then, once you have the desired spacing between the letters, simply scale the plane back to the correct size when you are out of edit mode. For multiple lines of text you will need a separate plane for each line. The text can now be manipulated using logic bricks or python. |
||