Username or E-mail
Password (Forgot?)
New? Sign Up
Join or Sign In
Forums Stencylpedia Stencyl TV Translations Go Pro - Plans & Pricing Download Stencyl


Switch to Book Layout

1: Getting Started

  • Getting Started
  • Crash Course
  • Crash Course 2
  • StencylForge

2: Building Logic

  • What is a Behavior?
  • Creating a Behavior
  • Attributes
  • Game Attributes
  • Attribute Types
  • Events
  • Our Behaviors

3: Actors

  • What are Actors?
  • Animations
  • Motion & Forces
  • Physics
  • Controls
  • Collisions & Groups
  • Killing vs. Recycling
  • Tweening
  • Effects
  • Chapter 3 Challenge

4: Scenes

  • Scene Basics
  • The Camera
  • Tilesets
  • Regions
  • Drawing Text & HUDs
  • Changing Scenes
  • Music, Sounds & Channels
  • Backgrounds
  • Customizing Actors
  • Chapter 4 Challenge

5: Game Mechanics

  • Saving
  • Pausing
  • 3rd Party Services
  • Web Requests

6: Advanced Topics

  • Get/Set Attributes
  • Custom Events
  • Blending Modes
  • Lists
  • Custom Blocks
  • Continuous Collisions

7: Testing & Tuning

  • Testing Games
  • Optimizing Performance 1
  • Optimizing Performance 2

8: The Last 10%

  • Flash Publishing
  • Standalone Apps
  • iOS App Store
  • Chrome Store
  • Making Money

M1: Mobile - Intro

  • Getting Started
  • Testing on your Device
  • Flash -> iOS Guide

M2: Mobile - Basics

  • Atlases
  • Drawing Text
  • Retina Display
  • Accelerometer
  • Joystick
  • Universal Games

M3: Mobile - Services

  • iAds
  • Game Center
  • In-App Purchases

M4: Mobile - Publishing

  • Debugging
  • Publishing to the App Store
  • Optimizing Performance
  • Promoting your Game

A: Troubleshooting

  • Showstoppers
  • General FAQ
  • iOS FAQ
  • The 90% Memory Warning
  • Recovering Broken Games
  • Can't Export to SWF
  • Reloading Documents
  • Generating Logs
  • Flash Security Settings
  • How to Report Bugs

B: How-To Guides

  • Importing Assets
  • Scene Designer
  • Code Mode
  • Font Editor
  • Pencyl (Image Editor)
  • Tile Editor (Shapes)
  • Game Cleaner

C: Reference

  • Glossary
  • Block Reference
  • Useful Shortcuts
  • Stencyl API

D: Resources

  • Stencyl TV
  • Abigayl's Guides
  • Giving Critiques
  • Creating Extensions
  • Translating Stencyl
  • Credits

3.0 Drafts (In Progress)

  • What's New in Stencyl 3.0?
  • Setup (Android)
  • Setup (Desktop)
  • Setup (iOS) - Concepts
  • Setup (iOS) - Mac
  • Setup (iOS) - Windows
  • Testing iOS on Windows
  • iOS Troubleshooter

  • Mobile App Scaling
  • Full Screen Mode
  • Simple Physics
  • Backgrounding an App

  • iOS App Store
  • Mac App Store
  • Windows Store
  • Google Play
  • HTML5

  • Android Ads
  • Android Purchases (WIP)
  • 4" Form Factor (iPhone 5)
  • Mobile Input
  • Mobile Features

  • Extending the Engine
  • iOS / Android Extensions
  • Developing the Official Extensions
  • Developing the Engine

  • iAds (Revised)
  • Game Center (Revised)
  • iOS Purchases (Revised)
  • Atlases (Revised)
  • Drawing Text (Revised)
  • Joystick (Revised)
  • Accelerometer (Revised)
  • Sounds (Revised, WIP)
  • Debugging (Revised, WIP)
  • iOS Performance (Revised)
Level: Beginner

Drawing Text with Labels (Mobile)

Contents

  • Introduction
  • Basics
  • Drawing with Labels (Stencyl 2.2 and below)
  • Drawing Directly (Stencyl 3.0+)

 

Introduction

Most games draw text to the screen. In mobile games, this method negatively affects game performance if used in excess, so we use a different method. There are two ways to draw text in mobile games for Stencyl:

  1. Directly inside the “when drawing” section of a behavior (not recommended)
  2. Using labels (recommended)
Note: In Stencyl 3.0, it is OK to draw text directly. You can still use labels (described below), but drawing text directly, if used in moderation is now acceptable.

 

Basics

Whichever method you choose, all text drawing involves three main properties

  1. Font (to style the text)
  2. The text itself
  3. Where to draw the text on screen

 

Drawing Text with Labels (Stencyl 2.2 and below)

Note: In Stencyl 3.0+, Labels are now an extension, rather than a behavior on StencylForge. Go to Game Settings > Extensions and enable the Labels extension. Close and reopen your game, and you'll find the Label blocks under the Custom Blocks category.

Labels are a special kind of actor that can display text. You can specify a font and text to draw for this actor. Like any other actor, a label has a position, rotation, opacity, and can have behaviors attached to it.

We recommend you use labels to optimize your game’s performance. Labels draw text quickly because they change infrequently. The drawback? They require a little more work to set up.

How to Create a Label

1) Create a blank Actor with a blank Animation.

2) Attach the “Label” behavior to the Actor. You'll find it under FROM YOUR LIBRARY > Utilities.

Note: If you're using Stencyl 1.4.1 or earlier, visit StencylForge and search for “Label for iOS” -- Download it

3) Configure the behavior to your liking. (Note: Current versions of the behavior may have more fields than this)

4) Add the actor to the desired scene. If you find it inconvenient that the Actor is "invisible", you can assign a dummy animation to the Actor. It won't display in-game.

How to Change a Label’s Text and Font

The “Label for iOS” behavior comes bundled with some custom blocks that let you change a label’s text and font. Look for them under the Custom category.

How to Move a Label Around

Labels are actors! You can move them around just like you’d move a regular actor around, setting the label’s position, setting the label’s speed, or a using motion tween, for example.

 

Drawing Text Directly (Stencyl 3.0+)

Draw text inside the “when drawing” section of a behavior, as shown below:

In Stencyl 3.0+, this no longer incurs the heavy performance penalty that was present in prior versions. You can still use labels (via an extension as described in the prior section), but this method is simple and likely the one many will use.

 

The Future

Drawing text will be simplified in the future for basic use cases. You'll be able to place a label directly in a scene from the scene designer and assign it a font and default text. You'll also be able to refer to it as a regular actor from behaviors.



Last Updated: 2013-04-10 by Jon

10022 have read this article
Disclaimer: The Stencyl Team does not actively monitor comments on articles. If you're seeking help for your game, please ask a question on the forums. Thanks!
8 Comments
weilies
in S3.0 does it support multiple line text? text wrap?
0 1 month, 1 week ago
pokemon12
s
0 1 month, 1 week ago
Jon
Losh started a topic here for those who want to localize games. (http://community.stencyl.com/index .php/topic,19118.0.html)
0 1 month, 2 weeks ago
losh
Localisation?
0 3 months, 3 weeks ago
Rubi
how do you update "drawing" scripts, like text=attributes?
0 6 months, 1 day ago
nuclearsheep
can you explain in the "how to change a label's text and font" category, where exactly to put those blocks?

this process is not working at all for me :/

1 1 year, 1 month ago
MerlinoDreamlab
It's possible to have multiline Text, Alignment and something for i18n?

Would like to use iStencyl for some Multimedia eBook iPad app like one we have already created (http://goo.gl/tyvK7)

1 1 year, 4 months ago
majormax
Is there an amount of text you can draw directly before it lags?
1 1 year, 5 months ago



Commenting Guidelines

Sign In to Comment

Make Games

  • What is Stencyl?
  • Roadmap
  • Pricing

Play

  • Arcade
  • Showcase

Community

  • Forums
  • Chat
  • Translations

Help

  • Stencylpedia
  • Stencyl TV

About Us

  • Blog
  • Contact Us
  • Press
  • Privacy
Follow Stencyl on Twitter



© 2013 Stencyl, LLC.