Class: Text

Phaser. Text

Phaser.Text

new Text(game, x, y, text, style)

Create a new <code>Text</code>.

Parameters:
Name Type Description
game Phaser.Game

Current game instance.

x number

X position of the new text object.

y number

Y position of the new text object.

text string

The actual text that will be written.

style object

The style object containing style attributes like font, font size ,

Source:

Members

alive

Properties:
Name Type Description
alive boolean

This is a handy little var your game can use to determine if an object is alive or not, it doesn't effect rendering.

Default Value:
  • true
Source:

anchor

The anchor sets the origin point of the texture. The default is 0,0 this means the textures origin is the top left Setting than anchor to 0.5,0.5 means the textures origin is centered Setting the anchor to 1,1 would mean the textures origin points will be the bottom right

Properties:
Name Type Description
anchor Phaser.Point

The anchor around which rotation and scaling takes place.

Source:

angle

Indicates the rotation of the Text, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90. If you wish to work in radians instead of degrees use the property Sprite.rotation instead.

Properties:
Name Type Description
angle number

Gets or sets the angle of rotation in degrees.

Source:

content

The string to be rendered by this Text object.

Properties:
Name Type Description
content string

The string to be rendered by this Text object.

Source:

exists

Properties:
Name Type Description
exists boolean

If exists = false then the Text isn't updated by the core game loop.

Default Value:
  • true
Source:

font

The font the text will be rendered in.

Properties:
Name Type Description
font string

The font the text will be rendered in.

Source:

game

Properties:
Name Type Description
game Phaser.Game

A reference to the currently running Game.

Source:

group

Properties:
Name Type Description
group Phaser.Group

The parent Group of this Text object.

Source:

name

Properties:
Name Type Description
name string

The user defined name given to this object.

Source:

renderable

Properties:
Name Type Description
renderable boolean

A renderable object will be rendered to the context each frame.

Source:

scale

Properties:
Name Type Description
scale Phaser.Point

The scale of the object when rendered. By default it's set to 1 (no scale). You can modify it via scale.x or scale.y or scale.setTo(x, y). A value of 1 means no change to the scale, 0.5 means "half the size", 2 means "twice the size", etc.

Source:

type

Properties:
Name Type Description
type number

The const type of this object.

Source:

x

The x coordinate of this object in world space.

Properties:
Name Type Description
x number

The x coordinate of this object in world space.

Source:

y

The y coordinate of this object in world space.

Properties:
Name Type Description
y number

The y coordinate of this object in world space.

Source:

Methods

destroy()

Source:

destroy()

Source:

update()

Automatically called by World.update.

Source:
Phaser Copyright © 2012-2013 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Thu Nov 28 2013 15:56:34 GMT-0000 (GMT) using the DocStrap template.