Constructor
new Text(x, y, color, text, fontopt, doCenteropt)
Creates a text object.
Creates a text object. Use createText for instantiation.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
x |
number | The x-coordinate. |
||
y |
number | The y-coordinate. |
||
color |
string | The text color. |
||
text |
string | The text content. |
||
font |
string |
<optional> |
"20px monospace" | The font style. |
doCenter |
boolean |
<optional> |
false | Whether to center the text horizontally. |
- Source:
Extends
Members
color :string
Text color
.Text color
Type:
- string
- Source:
doCenter :boolean
Whether to center the text horizontally
.Whether to center the text horizontally
Type:
- boolean
- Source:
font :string
Font style
.Font style
Type:
- string
- Source:
hidden :boolean
Whether the object is hidden
.Whether the object is hidden
Type:
- boolean
- Overrides:
- Source:
text :string
Text content
.Text content
Type:
- string
- Source:
x :number
X position
.X position
Type:
- number
- Overrides:
- Source:
y :number
Y position
.Y position
Type:
- number
- Overrides:
- Source:
Methods
changeXBy(x)
Changes the sprite’s position(ONLY X).
Changes the sprite’s position(ONLY X).
Parameters:
| Name | Type | Description |
|---|---|---|
x |
number | The x-coordinate you want to add/minus. |
- Source:
changeYBy(Y)
Changes the sprite’s position(ONLY Y).
Changes the sprite’s position(ONLY Y).
Parameters:
| Name | Type | Description |
|---|---|---|
Y |
number | The y-coordinate you want to add/minus. |
- Source:
draw()
Draws the text on the canvas.
Draws the text on the canvas.
- Overrides:
- Source:
goTo(x, y)
Sets the sprite’s position.
Sets the sprite’s position.
Parameters:
| Name | Type | Description |
|---|---|---|
x |
number | The new x-coordinate. |
y |
number | The new y-coordinate. |
- Source:
setX(x)
Sets the sprite’s position(ONLY X).
Sets the sprite’s position(ONLY X).
Parameters:
| Name | Type | Description |
|---|---|---|
x |
number | The new x-coordinate. |
- Source:
setY(y)
Sets the sprite’s position(ONLY Y).
Sets the sprite’s position(ONLY Y).
Parameters:
| Name | Type | Description |
|---|---|---|
y |
number | The new y-coordinate. |
- Source: