Book Image

Construct 2 Game Development by Example

By : John Bura
Book Image

Construct 2 Game Development by Example

By: John Bura

Overview of this book

Table of Contents (16 chapters)
Construct 2 Game Development by Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Where to Go from Here
Index

Adding text objects to the HUD


Next, we're going to create a HUD to tell the player what their score is. Let's start by adding a textbox to the screen. Click on Insert New Object and select Text from the General section.

Tip

Our new textbox doesn't look that exciting, so I'd suggest changing the size and font style. I've changed mine to Arial, Narrow Bold Italic, and size 36. It's best to stick to common fonts—Construct 2 draws on the font files available on the player's computer and if they don't have the same file as the one you have, it will substitute for a default that might not look proper.

Spawning the textbox

In order for the textbox to appear, we need to spawn it just like any other game object. Rewrite the text in the textbox to +100. This textbox will be spawned when the goalBall sprite is destroyed.

Add a new On every tick event, and then add a Move at angle action to the new textbox. This is shown in the following screenshot:

Set the angle to 270, which is the angle for directly...