Constructor
new Actor($stage)
- Description:
- Create a new actor.
- Source:
Example
class ActorExample extends Actor {}
Parameters:
Name | Type | Description |
---|---|---|
$stage |
Stage | The stage on which to create the actor. |
Members
collider :Collider
- Description:
- Gets the collider.
- Source:
Gets the collider.
Type:
engine :Engine
- Description:
- Gets the current engine.
- Source:
Gets the current engine.
Type:
sounds :Array.<Sound>
- Description:
- Gets the sounds.
- Source:
Gets the sounds.
Type:
- Array.<Sound>
sprite :Sprite
- Description:
- Gets the sprite.
- Source:
Gets the sprite.
Type:
stage :Stage
- Description:
- Gets the current stage.
- Source:
Gets the current stage.
Type:
translation :Vector2
- Description:
- Gets the position.
- Source:
Gets the position.
Type:
uuid :string
- Description:
- Gets the uuid.
- Source:
Gets the uuid.
Type:
- string
vibrations :Array.<Vibration>
- Description:
- Gets the vibrations.
- Source:
Gets the vibrations.
Type:
- Array.<Vibration>
visible :boolean
- Description:
- Gets the visible status.
- Source:
Gets the visible status.
Type:
- boolean
zIndex :number
- Description:
- Gets the z-index.
- Source:
Gets the z-index.
Type:
- number
Methods
addSound($sound) → {this}
- Description:
- Adds the given sound.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$sound |
Sound | The sound to add. |
Returns:
- Type
- this
addVibration($vibration) → {this}
- Description:
- Adds the given vibration.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$vibration |
Vibration | The vibration to add. |
Returns:
- Type
- this
getComponent($name) → {any}
- Description:
- Gets a component.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$name |
string | The name of the component to get. |
Returns:
- Type
- any
hasCollider() → {boolean}
- Description:
- Checks if the actor has a collider.
- Source:
Returns:
- Type
- boolean
hasComponent($name) → {boolean}
- Description:
- Checks if the actor has the given component.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$name |
string | The name of the component to check. |
Returns:
- Type
- boolean
hasSprite() → {boolean}
- Description:
- Checks if the actor has a sprite.
- Source:
Returns:
- Type
- boolean
onAfterRemove()
- Description:
- Called just after removing the actor.
- Source:
onBeforeRemove()
- Description:
- Called just before removing the actor.
- Source:
onCollide($parameters)
- Description:
- Called when a collision is being resolved.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$parameters |
Object | The given parameters. |
$parameters.$actor |
Actor | The colliding actor. |
$parameters.$east |
boolean | If the origin of collision is facing the east face. |
$parameters.$north |
boolean | If the origin of collision is facing the north face. |
$parameters.$south |
boolean | If the origin of collision is facing the south face. |
$parameters.$west |
boolean | If the origin of collision is facing the west face. |
onCollideEnter($parameters)
- Description:
- Called when a collision is being entered.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$parameters |
Object | The given parameters. |
$parameters.$actor |
Actor | The colliding actor. |
$parameters.$east |
boolean | If the origin of collision is facing the east face. |
$parameters.$north |
boolean | If the origin of collision is facing the north face. |
$parameters.$south |
boolean | If the origin of collision is facing the south face. |
$parameters.$west |
boolean | If the origin of collision is facing the west face. |
onCollideLeave($actor)
- Description:
- Called when a collision is being left.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$actor |
Actor | The colliding actor. |
onCreate()
- Description:
- Called when the actor is being created.
- Source:
onSetVisible($visible)
- Description:
- Called when the visible status is being set.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$visible |
boolean | The visible status set. |
onSetZIndex($zIndex)
- Description:
- Called when the z-index is being set.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$zIndex |
number | The z-index set. |
onSoundFinish($sound)
- Description:
- Called when a sound is finishing playing.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$sound |
Sound | The sound. |
onTick($timetick)
- Description:
- Called when the actor is being updated by one tick update.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$timetick |
number | The tick duration (in ms). |
onTranslate($vector)
- Description:
- Called when the actor is being translated.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$vector |
Vector2 | The translation applied. |
removeSound($sound) → {this}
- Description:
- Removes the given sound.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$sound |
Sound | The sound to remove. |
Returns:
- Type
- this
removeSounds() → {this}
- Description:
- Removes all sound.
- Source:
Returns:
- Type
- this
removeVibration($vibration) → {this}
- Description:
- Removes the given vibration.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$vibration |
Vibration | The vibration to remove. |
Returns:
- Type
- this
removeVibrations() → {this}
- Description:
- Removes all vibration.
- Source:
Returns:
- Type
- this
setCollider($collider) → {this}
- Description:
- Sets the collider.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$collider |
Collider | The collider to set. |
Returns:
- Type
- this
setComponent($name, $component) → {this}
- Description:
- Sets a component.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$name |
string | The name of the component to set. |
$component |
any | The value of the component to set. |
Returns:
- Type
- this
setSprite($sprite) → {this}
- Description:
- Sets the sprite.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$sprite |
Sprite | The sprite to set. |
Returns:
- Type
- this
setVisible($visible) → {this}
- Description:
- Sets the visible status.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$visible |
boolean | The visible status to set. |
Returns:
- Type
- this
setZIndex($zIndex) → {this}
- Description:
- Sets the z-index.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$zIndex |
number | The z-index to set. |
Returns:
- Type
- this
translate($vector) → {this}
- Description:
- Translates the actor in the world space from a third person point of view.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$vector |
Vector2 | The translation to apply. |
Returns:
- Type
- this
translateTo($vector) → {this}
- Description:
- Translates the actor in the world space to the given position.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$vector |
Vector2 | The position to translate to. |
Returns:
- Type
- this