"Draw Text" is a function of the HUD class that is used to draw text on the screen.
- Text: Variable of type String containing the text that will be drawn.
- Text Color: Color that will be used when drawing the text.
- Screen X: X position of the screen where the text will be drawn. The value of X starts at the left of the screen and increases to the right.
- Screen Y: Y position of the screen where the text will be drawn. The Y value starts at the top of the screen and increases from top to bottom.
- Font: Font used to draw the text. If none is chosen, the default font will be used.
- Scale: Used to change the size of the text.
- Scale Position: Indicates whether the scale should also affect the position of the text.
A Blueprint called "MyGameHUD" was created using the HUD class as Parent. The "Draw Text" function must be used in the "Receive Draw HUD" event that belongs to the HUD class. Two "Draw Text" functions were used, one to display the number of lives and the other to display the score.
|Click to enlarge|
The number of lives is drawn in blue in the screen coordinate (X = 20, Y = 10) and the score is drawn in green in the screen coordinate (X = 20, Y = 50). To use this HUD class you must select it in the GameMode blueprints that are being used at the level or it can be configured in the level editor in the option "Settings → World Settings → Game Mode".
Table of Contents