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.

Returns

A particle emitter can be used for one-time explosions or for
continuous effects like rain and fire. All it really does is launch Particle objects out
at set intervals, and fixes their positions and velocities accordingly.

Parameters

Name

Type

Argument

Default

Description

x

number

<optional>

0

The x coordinate within the Emitter that the particles are emitted from.

y

number

<optional>

0

The y coordinate within the Emitter that the particles are emitted from.

The image used as a texture by this display object during rendering. If a string Phaser will get for an entry in the Image Cache. Or it can be an instance of a RenderTexture, BitmapData, Video or PIXI.Texture.

frame

string
|
number

<optional>

If a Texture Atlas or Sprite Sheet is used this allows you to specify the frame to be used. Use either an integer for a Frame ID or a string for a frame name.

A RetroFont can be used as a texture for an Image or Sprite and optionally add it to the Cache.
A RetroFont uses a bitmap which contains fixed with characters for the font set. You use character spacing to define the set.
If you need variable width character support then use a BitmapText object instead. The main difference between a RetroFont and a BitmapText
is that a RetroFont creates a single texture that you can apply to a game object, where-as a BitmapText creates one Sprite object per letter of text.
The texture can be asssigned or one or multiple images/sprites, but note that the text the RetroFont uses will be shared across them all,
i.e. if you need each Image to have different text in it, then you need to create multiple RetroFont objects.

Parameters

Name

Type

Argument

Default

Description

font

string

The key of the image in the Game.Cache that the RetroFont will use.

characterWidth

number

The width of each character in the font set.

characterHeight

number

The height of each character in the font set.

chars

string

The characters used in the font set, in display order. You can use the TEXT_SET consts for common font set arrangements.

charsPerRow

number

The number of characters per row in the font set.

xSpacing

number

<optional>

0

If the characters in the font set have horizontal spacing between them set the required amount here.

ySpacing

number

<optional>

0

If the characters in the font set have vertical spacing between them set the required amount here.

xOffset

number

<optional>

0

If the font set doesn't start at the top left of the given image, specify the X coordinate offset here.

yOffset

number

<optional>

0

If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here.

The image used as a texture by this display object during rendering. If a string Phaser will get for an entry in the Image Cache. Or it can be an instance of a RenderTexture, BitmapData, Video or PIXI.Texture.

frame

string
|
number

<optional>

If a Texture Atlas or Sprite Sheet is used this allows you to specify the frame to be used. Use either an integer for a Frame ID or a string for a frame name.

At its most basic a Sprite consists of a set of coordinates and a texture that is used when rendered.
They also contain additional properties allowing for physics motion (via Sprite.body), input handling (via Sprite.input),
events (via Sprite.events), animation (via Sprite.animations), camera culling and more. Please see the Examples for use cases.

Parameters

Name

Type

Argument

Default

Description

x

number

<optional>

0

The x coordinate of the sprite. The coordinate is relative to any parent container this sprite may be in.

y

number

<optional>

0

The y coordinate of the sprite. The coordinate is relative to any parent container this sprite may be in.

The image used as a texture by this display object during rendering. If a string Phaser will get for an entry in the Image Cache. Or it can be an instance of a RenderTexture, BitmapData, Video or PIXI.Texture.

frame

string
|
number

<optional>

If a Texture Atlas or Sprite Sheet is used this allows you to specify the frame to be used. Use either an integer for a Frame ID or a string for a frame name.

Returns

A SpriteBatch is a really fast version of a Phaser Group built solely for speed.
Use when you need a lot of sprites or particles all sharing the same texture.
The speed gains are specifically for WebGL. In Canvas mode you won't see any real difference.

The map can either be populated with data from a Tiled JSON file or from a CSV file.
To do this pass the Cache key as the first parameter. When using Tiled data you need only provide the key.
When using CSV data you must provide the key and the tileWidth and tileHeight parameters.
If creating a blank tilemap to be populated later, you can either specify no parameters at all and then use Tilemap.create or pass the map and tile dimensions here.
Note that all Tilemaps use a base tile size to calculate dimensions from, but that a TilemapLayer may have its own unique tile size that overrides it.

Parameters

Name

Type

Argument

Default

Description

key

string

<optional>

The key of the tilemap data as stored in the Cache. If you're creating a blank map either leave this parameter out or pass null.

tileWidth

number

<optional>

32

The pixel width of a single map tile. If using CSV data you must specify this. Not required if using Tiled map data.

tileHeight

number

<optional>

32

The pixel height of a single map tile. If using CSV data you must specify this. Not required if using Tiled map data.

width

number

<optional>

10

The width of the map in tiles. If this map is created from Tiled or CSV data you don't need to specify this.

height

number

<optional>

10

The height of the map in tiles. If this map is created from Tiled or CSV data you don't need to specify this.

The image used as a texture by this display object during rendering. If a string Phaser will get for an entry in the Image Cache. Or it can be an instance of a RenderTexture, BitmapData, Video or PIXI.Texture.

frame

string
|
number

<optional>

If a Texture Atlas or Sprite Sheet is used this allows you to specify the frame to be used. Use either an integer for a Frame ID or a string for a frame name.