GameObjectFactory#bitmapText()

bitmapText(x, y, font, text, size, group) → {Phaser.BitmapText}

Create a new BitmapText object.

BitmapText objects work by taking a texture file and an XML file that describes the font structure.
It then generates a new Sprite object for each letter of the text, proportionally spaced out and aligned to
match the font structure.

BitmapText objects are less flexible than Text objects, in that they have less features such as shadows, fills and the ability
to use Web Fonts. However you trade this flexibility for pure rendering speed. You can also create visually compelling BitmapTexts by
processing the font texture in an image editor first, applying fills and any other effects required.

To create multi-line text insert \r, \n or \r\n escape codes into the text string.

To create a BitmapText data files you can use:

BMFont (Windows, free): http://www.angelcode.com/products/bmfont/
Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner
Littera (Web-based, free): http://kvazars.com/littera/

Parameters
Name Type Argument Default Description
x number

X coordinate to display the BitmapText object at.

y number

Y coordinate to display the BitmapText object at.

font string

The key of the BitmapText as stored in Phaser.Cache.

text string <optional>
''

The text that will be rendered. This can also be set later via BitmapText.text.

size number <optional>
32

The size the font will be rendered at in pixels.

group Phaser.Group <optional>

Optional Group to add the object to. If not specified it will be added to the World group.

Returns

The newly created bitmapText object.

Source code: gameobjects/GameObjectFactory.js (Line 425)
doc_phaser
2017-02-14 10:48:39
Comments
Leave a Comment

Please login to continue.