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
-
- Default Value:
- true
- Source:
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.
-
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
- Source:
Properties:
Name Type Description anchor
Phaser.Point The anchor around which rotation and scaling takes place.
-
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.
- Source:
Properties:
Name Type Description angle
number Gets or sets the angle of rotation in degrees.
-
content
-
The string to be rendered by this Text object.
- Source:
Properties:
Name Type Description content
string The string to be rendered by this Text object.
-
exists
-
- Default Value:
- true
- Source:
Properties:
Name Type Description exists
boolean If exists = false then the Text isn't updated by the core game loop.
-
font
-
The font the text will be rendered in.
- Source:
Properties:
Name Type Description font
string The font the text will be rendered in.
-
game
-
- Source:
Properties:
Name Type Description game
Phaser.Game A reference to the currently running Game.
-
group
-
- Source:
Properties:
Name Type Description group
Phaser.Group The parent Group of this Text object.
-
name
-
- Source:
Properties:
Name Type Description name
string The user defined name given to this object.
-
renderable
-
- Source:
Properties:
Name Type Description renderable
boolean A renderable object will be rendered to the context each frame.
-
scale
-
- Source:
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.
-
type
-
- Source:
Properties:
Name Type Description type
number The const type of this object.
-
x
-
The x coordinate of this object in world space.
- Source:
Properties:
Name Type Description x
number The x coordinate of this object in world space.
-
y
-
The y coordinate of this object in world space.
- Source:
Properties:
Name Type Description y
number The y coordinate of this object in world space.
Methods
-
destroy()
-
- Source:
-
destroy()
-
- Source:
-
update()
-
Automatically called by World.update.
- Source: