Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Stencyl Essentials

You're reading from   Stencyl Essentials Build beautiful, unique, cross-platform games rapidly with the free Stencyl 2D game engine and toolset

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher
ISBN-13 9781784399450
Length 206 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Richard Sneyd Richard Sneyd
Author Profile Icon Richard Sneyd
Richard Sneyd
Arrow right icon
View More author details
Toc

Rendering text to the screen


Now that we have created the logic that tracks the score based on how many coins the player has collected, it is imperative that we render this information to the HUD so that the player can view their score as they progress through the game. To do this, we will use the font we imported earlier. Follow these steps to draw the score value in the HUD:

  1. In the Player Handler, we must add a When Drawing event. Navigate to Add Event | Basics | When Drawing.

  2. The drawing blocks are now visible under their own category, called Drawing, in the blocks palette. Drag out a draw text at block and snap it into the when drawing event block, as shown in the following screenshot:

  3. For the text field in our draw text at block, click on the small, downward grey arrow to bring up the menu shown in the following screenshot. Navigate to and select Text | Basics | Operations | Text & Text (this is a concatenator, which means that it combines two strings of a text into one):

  4. In the first...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image