Displaying multiple pickups of the same object with text totals
When several items of the same type have been picked up, often the simplest way to convey what is being carried to the user is to display a text message showing the numeric total of each item type being carried, as shown in the following screenshot. In this recipe, the total number of stars collected is displayed using a UI Text object.
Getting ready
This recipe assumes you are starting with project Simple2Dgame_SpaceGirl
setup from the first recipe in this chapter. The font you need can be found in folder 1362_02_02
.
How to do it...
To display inventory total text for multiple pickups of same type of object, follow these steps:
Start with a new copy of the mini-game
Simple2Dgame_SpaceGirl
.Add a UI Text object (Create | UI | Text). Rename it
Text-carrying-star
. Change its text to stars = 0.Import the provided
Fonts
folder into your project.In the Inspector panel, set the font of
Text-carrying-star
to Xolonium-Bold (folderFonts
)...