Entity

platypus. Entity

The Entity object acts as a container for components, facilitates communication between components and other game objects, and includes properties set by components to maintain a current state. The entity object serves as the foundation for most of the game objects in the platypus engine.

JSON Definition Example

     {
         "id": "entity-id",
        // "entity-id" becomes `entity.type` once the entity is created.
    
        "components": [
        // This array lists one or more component definition objects
    
            {"type": "example-component"}
            // The component objects must include a "type" property corresponding to a component to load, but may also include additional properties to customize the component in a particular way for this entity.
        ],
    
        "properties": {
        // This object lists properties that will be attached directly to this entity.
    
            "x": 240
            // For example, `x` becomes `entity.x` on the new entity.
        },

        "preload": ['image.png', 'sound.mp3']
        // assets that need to be loaded before this entity loads
    }

Constructor

new Entity(definitionopt, instanceDefinitionopt, callbackopt, parentopt) → {Entity}

Source:
Parameters:
Name Type Attributes Description
definition Object <optional>

Base definition for the entity.

Name Type Attributes Description
id Object <optional>

This declares the type of entity and will be stored on the Entity as entity.type after instantiation.

components Object <optional>

This lists the components that should be attached to this entity.

properties Object <optional>

[definition.properties] This is a list of key/value pairs that are added directly to the Entity as entity.key = value.

instanceDefinition Object <optional>

Specific instance definition including properties that override the base definition properties.

Name Type Attributes Description
properties Object <optional>

This is a list of key/value pairs that are added directly to the Entity as entity.key = value.

callback function <optional>

A function to run once all of the components on the Entity have been loaded. The first parameter is the entity itself.

parent Entity <optional>

Presets the parent of the entity so that the parent entity is available during component instantiation. Overrides parent in properties definitions.

Fires:
Returns:
Type:
Entity

Returns the new entity made up of the provided components.

Extends

Members

destroyed :Boolean

This read-only property shows whether this Messenger is destroyed.

Properties:
Name Type Description
destroyed
Overrides:
Default Value:
  • false
Source:
Type:
  • Boolean

Methods

(static) getAssetList(definition, properties, data) → {Array}

Returns all of the assets required for this Entity. This method calls the corresponding method on all components to determine the list of assets.

Source:
Parameters:
Name Type Description
definition Object

The definition for the Entity.

properties Object

Properties for this instance of the Entity.

data Object

Layer data that affects asset list.

Returns:
Type:
Array

A list of the necessary assets to load.

addComponent(component) → {platypus.Component}

Attaches the provided component to the entity.

Source:
Parameters:
Name Type Description
component platypus.Component

Must be an object that functions as a Component.

Fires:
Returns:
Type:
platypus.Component

Returns the same object that was submitted.

destroy()

This method removes all components from the entity.

Overrides:
Source:

getMessageIds() → {Array}

This method returns all the messages that this entity is concerned about.

Overrides:
Source:
Returns:
Type:
Array

An array of strings listing all the messages for which this Messenger has handlers.

off(name, callback)

Remove the event listener

Overrides:
Source:
Parameters:
Name Type Description
name String

The type of event; if no name is specifed remove all listeners.

callback function

The listener function.

on(name, callback)

Add an event listener. The parameters for the listener functions depend on the event.

Overrides:
Source:
Parameters:
Name Type Description
name String

The type of event.

callback function

The callback function when event is triggered.

remove-entity(entity)

On receiving this message, the provided entity will be removed from the list of child entities.

Source:
Parameters:
Name Type Description
entity platypus.Entity

The entity to remove.

removeComponent(component) → {Component}

Removes the mentioned component from the entity.

Source:
Parameters:
Name Type Description
component Component

Must be a [[Component]] attached to the entity.

Fires:
Returns:
Type:
Component

Returns the same object that was submitted if removal was successful; otherwise returns false (the component was not found attached to the entity).

set-parent-render-container(entity, container)

Sets the parent render container of an entity to that of the given entity or entity with the given id.

Source:
Parameters:
Name Type Description
entity Object

The entity to relocate.

container Entity | String | PIXI.Container

The entity, id of the entity, or PIXI.Container that will act as the parent container.

setProperty(properties)

This method sets one or more properties on the entity.

Source:
Parameters:
Name Type Description
properties Object

A list of key/value pairs to set as properties on the entity.

toJSON(includeComponents) → {Object}

Returns a JSON object describing the entity.

Source:
Parameters:
Name Type Description
includeComponents Boolean

Whether the returned JSON should list components. Defaults to false to condense output since components are generally defined in platypus.game.settings.entities, but may be needed for custom-constructed entities not so defined.

Returns:
Type:
Object

Returns a JSON definition that can be used to recreate the entity.

toString() → {String}

Returns a string describing the entity.

Overrides:
Source:
Returns:
Type:
String

Returns the entity type as a string of the form "[Entity entity-type]".

trigger(event, value, debug) → {number}

This method is used by both internal components and external entities to trigger messages. When triggered, Messenger checks through bound handlers to run as appropriate. This handles multiple event structures: "", [], and {}

Overrides:
Source:
Parameters:
Name Type Description
event String | Array | Object

This is the message(s) to process. This can be a string, an object containing an "event" property (and optionally a "message" property, overriding the value below), or an array of the same.

value *

This is a message object or other value to pass along to event handler.

debug boolean

This flags whether to output message contents and subscriber information to the console during game development. A "value" object parameter (above) will also set this flag if value.debug is set to true.

Returns:
Type:
number

The number of handlers for the triggered message.

triggerEvent(event, valueopt) → {number}

This method is used by both internal components and external entities to trigger messages on this entity. When triggered, entity checks through bound handlers to run as appropriate. This method is identical to Spring Roll's EventDispatcher.trigger, but uses alternative Array methods to alleviate excessive GC.

Overrides:
Source:
Parameters:
Name Type Attributes Description
event String

This is the message to process.

value * <optional>

This is a message object or other value to pass along to event handler.

Name Type Attributes Description
debug boolean <optional>

This flags whether to output message contents and subscriber information to the console during game development.

Returns:
Type:
number

The number of handlers for the triggered message.

Events

[active-state]

Broadcasts active states using the JSON-defined message on each handle-controller message. Active states include pressed being true or released being true. If both of these states are false, the message is not broadcasted.

Source:
Parameters:
Name Type Description
message.pressed Boolean

Whether the current input is active.

message.released Boolean

Whether the current input was active last tick but is no longer active.

message.triggered Boolean

Whether the current input is active but was not active last tick.

message.over Boolean

Whether the mouse was over the entity when pressed, released, or triggered. This value is always false for non-mouse input messages.

accelerate

Changes the velocity of the Entity when in motion.

Source:
Parameters:
Name Type Description
velocity Number | platypus.Vector

The magnitude or Vector to multiply the current velocity by.

add-collision-entity

On receiving 'collide-on', this message is triggered on the parent to turn on collision.

Source:
Parameters:
Name Type Description
entity platypus.Entity

The entity this component is attached to.

add-entity

This message will added the given entity to this component's list of entities.

Source:
Parameters:
Name Type Attributes Description
entity platypus.Entity

This is the entity to be added as a child.

callback function <optional>

A function to run once all of the components on the Entity have been loaded.

Listeners of This Event:

add-node

Expects a node definition to create a node in the NodeMap.

Source:
Parameters:
Name Type Description
definition Object

Key/value pairs.

Name Type Description
nodeId String | Array

This value becomes the id of the Node. Arrays are joined using "|" to create the id string.

type String

This determines the type of the node.

x String

Sets the x axis position of the node.

y String

Sets the y axis position of the node.

z String

Sets the z axis position of the node.

neighbors Object

A list of key/value pairs where the keys are directions from the node and values are node ids. For example: {"west": "node12"}.

Listeners of This Event:

add-remove-component-complete

This message is triggered on the entity itself when its components change.

Source:

add-tiles

This event adds a layer of tiles to render on top of the existing layer of rendered tiles.

Source:
Parameters:
Name Type Description
message.imageMap Array

This is a 2D mapping of tile indexes to be rendered.

Listeners of This Event:

animation-ended

This event fires each time an animation completes.

Source:
Parameters:
Name Type Description
animation String

The id of the animation that ended.

append-transform

This message performs an immediate transform of the entity by performing the transformation via an appended matrix multiplication.

Source:
Parameters:
Name Type Description
transform Array | String

A 3x3 @D Array or a string describing a transformation.

Listeners of This Event:

attach

Creates and attaches the entity. The input value makes it possible to attach the entity on user input.

Source:
Parameters:
Name Type Description
input Object

An input object.

Name Type Description
pressed Boolean

If set to true, the entity is created and attached.

Listeners of This Event:

blocked

This message is triggered if the entity collides while racing.

Source:
Parameters:
Name Type Description
collision platypus.CollisionData

Collision information from the entity or tile that blocked movement.

cache

On receiving a "cache" event, this component triggers "cache-sprite" to cache its rendering into the background. This is an optimization for static images to reduce render calls.

Source:
Listeners of This Event:

cache-sprite

On receiving a "cache" event, this component triggers "cache-sprite" to cache its rendering into the background. This is an optimization for static images to reduce render calls.

Source:
Parameters:
Name Type Description
entity platypus.Entity

This component's owner.

Listeners of This Event:

camera-loaded

On receiving a "world-loaded" message, the camera broadcasts the world size to all children in the world.

Source:
Parameters:
Name Type Description
camera Object
Name Type Description
world platypus.AABB

The dimensions of the world.

viewport platypus.AABB

The AABB describing the camera viewport in world units.

Listeners of This Event:

camera-update

This component fires "camera-update" when the position of the camera in the world has changed. This event is triggered on both the entity (typically a layer) as well as children of the entity.

Source:
Parameters:
Name Type Description
message Object
Name Type Description
world platypus.AABB

The dimensions of the world map.

orientation Number

Number describing the orientation of the camera.

scaleX Number

Number of window pixels that comprise a single world coordinate on the x-axis.

scaleY Number

Number of window pixels that comprise a single world coordinate on the y-axis.

viewport platypus.AABB

An AABB describing the world viewport area.

stationary Boolean

Whether the camera is moving.

cancelled

This event is triggered when the button is pressed and the mouse/touch is dragged off-target before release.

Source:
Parameters:
Name Type Description
buttonState platypus.Data

The state of the button

Name Type Description
pressed Boolean

This is false for the 'cancelled' event.

released Boolean

This is true for the 'cancelled' event.

triggered Boolean

This is false for the 'cancelled' event.

entity platypus.Entity

The entity for which the original event occurred.

carry-me

This message is triggered on a potential carrying peer, notifying the peer that this entity is portable.

Source:
Parameters:
Name Type Description
message.entity platypus.Entity

This entity, requesting to be carried.

Listeners of This Event:

change-attachment-offset

Changes the x, y, and z offset of the attachment.

Source:
Parameters:
Name Type Description
offset Object

An object containing the offset values.

input.x Number

The new X offset.

input.y Number

The new Y offset.

input.y Number

The new Z offset.

Listeners of This Event:

change-count

Changes the count to the given value.

Source:
Parameters:
Name Type Description
data.count number

The new count value.

Listeners of This Event:

change-tile

This event edits the tile index of a rendered tile.

Source:
Parameters:
Name Type Attributes Description
tile String

A string representing the name of the tile to switch to.

x Number

The column of the tile to edit.

y Number

The row of the tile to edit.

z Number <optional>

If RenderTiles has multiple layers, this value specifies the layer, with 0 being the bottom-most layer.

Listeners of This Event:

change-total

Changes the total to the given value.

Source:
Parameters:
Name Type Description
data.total number

The new total value.

Listeners of This Event:

chase

This event is triggered whenever the entity begins chasing another entity or stops chasing another entity.

Source:
Parameters:
Name Type Description
chasing boolean

Whether the entity is chasing another entity.

check-collision-group

This event is triggered on the entity (layer) to test collisions once logic has been completed.

Source:
Parameters:
Name Type Description
tick Object
Name Type Description
delta Number

The time that has passed since the last tick.

camera null | platypus.AABB

The range of the logic camera area. This is typically larger than the visible camera. This value is null if alwaysOn is set to true on this component.

entities Array

This is a list of all the logically active entities.

Listeners of This Event:

child-entity-added

This message is triggered when a new entity has been added to the list of children entities.

Source:
Parameters:
Name Type Description
entity platypus.Entity

The entity that was just added.

child-entity-removed

This message is triggered when an entity has been removed from the list of children entities.

Source:
Parameters:
Name Type Description
entity platypus.Entity

The entity that was just added.

child-entity-updated

This message is triggered on the parent when the entity's components change.

Source:
Parameters:
Name Type Description
entity platypus.Entity

This is the entity itself.

clip-complete

When a sound effect is finished playing, this event is triggered.

Source:

collide-off

On receiving this message, the component triggers remove-collision-entity on the parent.

Source:
Parameters:
Name Type Description
type String

If specified, only collision components of this type are removed from the collision list.

collide-on

On receiving this message, the component triggers add-collision-entity on the parent.

Source:
Parameters:
Name Type Description
type String

If specified, only collision components of this type are added to the collision list.

complete-tweens

On receiving this message, any currently running orientation tweens are immediately completed to give the entity a new stable position.

Source:
Listeners of This Event:

component-added

The entity triggers component-added on itself once a component has been attached, notifying other components of their peer component.

Source:
Parameters:
Name Type Description
component platypus.Component

The added component.

Name Type Description
type String

The type of component.

component-removed

The entity triggers component-removed on itself once a component has been removed, notifying other components of their peer component's removal.

Source:
Parameters:
Name Type Description
component Component

The removed component.

Name Type Description
type String

The type of component.

Listeners of This Event:

control-acceleration

This event controls whether the acceleration is active or inactive.

Source:
Parameters:
Name Type Description
control Object | boolean

If true, this motion becomes active. If false or {pressed: false}, the motion becomes inactive.

Listeners of This Event:

control-velocity

This event controls whether this velocity is active or inactive.

Source:
Parameters:
Name Type Description
control Object | boolean

If true, this motion becomes active. If false or {pressed: false}, the motion becomes inactive.

Listeners of This Event:

created-level

Dispatched when the scene has loaded and the level has been composited. This occurs before "load-level" to send out level before it's loaded in case it needs to be saved or edited before being loaded.

Source:
Parameters:
Name Type Description
data Object
Name Type Description
level Object

An object describing the level dimensions, tiles, and entities.

persistentData Object

The persistent data passed from the last scene. We add levelBuilder data to it to pass on.

Name Type Description
levelTemplate Object

A 1D or 2D array of level piece ids. The template defines how the pieces will be arranged and which pieces can be used where. The template must be rectangular in dimensions.

levelPieces Object

An object of key/value pairs listing the pieces that map to an id in the level template.

useUniques Boolean

If true, no single map piece is used twice in the creation of the combined map.

destroy-me

This component will set the entity up for removal on receiving this message.

Source:
Listeners of This Event:

detach

Detaches and removes the entity.

Source:
Listeners of This Event:

disable

Disables the entity.

Source:
Listeners of This Event:

dispatch-event

This event dispatches a PIXI.Event on this component's PIXI.Sprite. Useful for rerouting mouse/keyboard events.

Source:
Parameters:
Name Type Description
event Object | PIXI.Event

The event to dispatch.

Listeners of This Event:

drop-tweens

On receiving this message, any currently running orientation tweens are discarded, returning the entity to its last stable position.

Source:
Listeners of This Event:

east

If the soft joystick is enabled on this component, it will broadcast this directional message if the joystick is dragged due east.

Source:
Parameters:
Name Type Description
message Event

The original pointer event object is passed along with the control message.

east-northeast

If the soft joystick is enabled on this component, it will broadcast this directional message if the joystick is dragged due east-northeast.

Source:
Parameters:
Name Type Description
message Event

The original pointer event object is passed along with the control message.

east-southeast

If the soft joystick is enabled on this component, it will broadcast this directional message if the joystick is dragged due east-southeast.

Source:
Parameters:
Name Type Description
message Event

The original pointer event object is passed along with the control message.

enable

Enables the entity.

Source:
Listeners of This Event:

entity-created

Called when this entity spawns a new entity, this event links the newly created entity to this entity.

Source:
Parameters:
Name Type Description
entity platypus.Entity

The entity to link.

Listeners of This Event:

face

Set the direction the entity should face while stopped.

Source:
Parameters:
Name Type Description
direction String

A value such as "north" or "left" to point the entity in a particular direction.

follow

This component fires this message on this entity's parent so the camera will begin following this entity.

Source:
Parameters:
Name Type Description
message Object
Name Type Attributes Description
mode String

Can be "locked", "forward", "bounding", "anchor-bound", or "static". "static" suspends following, but the other three settings require that the entity parameter be defined. Also set the bounding area parameters if sending "bounding" as the following method and the movement parameters if sending "forward" as the following method.

entity platypus.Entity <optional>

The entity that the camera should commence following.

top number <optional>

The top of a bounding box following an entity.

left number <optional>

The left of a bounding box following an entity.

width number <optional>

The width of a bounding box following an entity.

height number <optional>

The height of a bounding box following an entity.

movementX number <optional>

Movement multiplier for focusing the camera ahead of a moving entity in the horizontal direction.

movementY number <optional>

Movement multiplier for focusing the camera ahead of a moving entity in the vertical direction.

offsetX number <optional>

How far to offset the camera from the entity horizontally.

offsetY number <optional>

How far to offset the camera from the entity vertically.

time number <optional>

How many milliseconds to follow the entity.

Listeners of This Event:

follow-me

On receiving this message, the component will trigger a message requesting that the parent camera begin following this entity.

Source:
Parameters:
Name Type Attributes Description
options Object <optional>

A list of key/value paris describing camera options to set.

Name Type Attributes Description
mode String <optional>

Camera following mode.

top number <optional>

The top of a bounding box.

left number <optional>

The left of a bounding box.

width number <optional>

The width of a bounding box.

height number <optional>

The height of a bounding box.

offsetX number <optional>

How far to offset the camera from the entity horizontally.

offsetY number <optional>

How far to offset the camera from the entity vertically.

time number <optional>

How many milliseconds to follow the entity.

Listeners of This Event:

force-release

On receiving this message, this component immediately triggers 'release-me' on its owner's carrier.

Source:
Listeners of This Event:

go-down

Triggers this event when the entity is moving up and collides with something.

Source:

go-left

Triggers this event when the entity is moving right and collides with something.

Source:

go-right

Triggers this event when the entity is moving left and collides with something.

Source:

go-up

Triggers this event when the entity is moving down and collides with something.

Source:

handle-ai

AI components listen in order to perform their logic on each tick.

Source:
Parameters:
Name Type Description
tick.delta Number

The time that has passed since the last tick as manipulated by the timeMultiplier.

tick.gameDelta Number

The time that has passed since the last tick. Unmanipulated by timeMultiplier. Use for components that need to run on actual time.

tick.camera null | platypus.AABB

The range of the logic camera area. This is typically larger than the visible camera. This value is null if alwaysOn is set to true on this component.

tick.entities Array

This is a list of all the logically active entities.

tick.tick Object

Tick object from "tick" event.

handle-controller

Triggered on owner and child entities on each tick to handle whatever they need to regarding controls.

Source:
Parameters:
Name Type Description
tick Object

An object containing tick data.

Listeners of This Event:

handle-logic

This event is triggered on the top-level layer to signify a "handle-logic" event is about to be triggered on children, and is then subsequently triggered on all of the layer's child entities. This is unique from the layer's "tick" event in that it occurs the same number of times as the "handle-logic" event and will not occur if HandlerLogic is paused.

Source:
Parameters:
Name Type Description
tick.delta Number

The time that has passed since the last tick as manipulated by the timeMultiplier.

tick.gameDelta Number

The time that has passed since the last tick. Unmanipulated by timeMultiplier. Use for components that need to run on actual time.

tick.camera null | platypus.AABB

The range of the logic camera area. This is typically larger than the visible camera. This value is null if alwaysOn is set to true on this component.

tick.entities Array

This is a list of all the logically active entities.

tick.tick Object

Tick object from "tick" event.

handle-movement

This event is triggered on children entities to move. This happens immediately after logic so entity logic can determine movement.

Source:
Parameters:
Name Type Description
tick Object
Name Type Description
delta Number

The time that has passed since the last tick.

camera null | platypus.AABB

The range of the logic camera area. This is typically larger than the visible camera. This value is null if alwaysOn is set to true on this component.

entities Array

This is a list of all the logically active entities.

Listeners of This Event:

handle-post-collision-logic

This event is triggered on entities to run logic that may depend upon collision responses.

Source:
Parameters:
Name Type Description
tick Object
Name Type Description
delta Number

The time that has passed since the last tick.

camera null | platypus.AABB

The range of the logic camera area. This is typically larger than the visible camera. This value is null if alwaysOn is set to true on this component.

entities Array

This is a list of all the logically active entities.

handle-render

Triggered every tick on owner and its children entities.

Source:
Parameters:
Name Type Description
data Object
Name Type Description
delta Number

The delta time for this tick as manipulated by the timeMultiplier.

gameDelta Number

The delta time for this tick. Unmanipulated by the timeMultiplier. Use for components that should always run according to actual time.

container PIXI.Container

The display Container the entities display objects should be added to.

tick Object

Tick object from "tick" event.

handle-render-load

Triggered on an entity added to the parent.

Source:
Parameters:
Name Type Description
data Object
Name Type Description
delta Number

The delta time for this tick.

container PIXI.Container

The display Container the entities display objects should be added to.

hide

This event makes the spine invisible.

Source:
Listeners of This Event:

hide-sprite

This event makes the sprite invisible.

Source:
Listeners of This Event:

highlight

Sets the entity's highlighted state to true.

Source:
Listeners of This Event:

hit-by-*

When an entity collides with an entity of a listed collision-type, this message is triggered on the entity. * is the other entity's collision-type.

Source:
Parameters:
Name Type Description
collision Object
Name Type Description
entity Entity

The entity with which the collision occurred.

target Entity

The entity that's receiving the collision event.

type String

The collision type of the other entity.

shape CollisionShape

This is the shape of the other entity that caused the collision.

x number

Returns -1, 0, or 1 indicating on which side of this entity the collision occurred: left, neither, or right respectively.

y number

Returns -1, 0, or 1 indicating on which side of this entity the collision occurred: top, neither, or bottom respectively.

Listeners of This Event:

hit-solid

On receiving this message, this component stops all velocities along the axis of the collision direction and sets "grounded" to true if colliding with the ground.

Source:
Parameters:
Name Type Description
collisionInfo Object
Name Type Description
direction platypus.Vector

The direction of collision from the entity's position.

in-location

This event is triggered if the entity is placed on the map but not assigned a node. It is moved to the nearest node and "in-location" is triggered.

Source:
Parameters:
Name Type Description
entity platypus.Entity

The entity that is in location.

increment-count

Increments the count by 1.

Source:
Listeners of This Event:

input-on

This event is triggered once HandlerRender is ready to handle interactivity.

Source:
Listeners of This Event:

input-precedence-updated

Triggered on owner and child entities when player uses a new imput method. (For example, going from mouse to keyboard or keyboard to gamepad.)

Source:
Parameters:
Name Type Description
inputs Array

A list of input methods, ordered by precedence with index 0 being the most recent input method.

instant-begin

This event triggers the beginning of an instant motion.

Source:
Listeners of This Event:

instant-end

This event triggers the end of an instant motion.

Source:
Listeners of This Event:

instant-motion

This event triggers an instant motion.

Source:
Parameters:
Name Type Description
control Object | boolean

If true, this motion becomes active. If false or {triggered: false}, the motion becomes inactive.

Listeners of This Event:

joystick-orientation

If the soft joystick is enabled on this component, this message will trigger to provide the current orientation of the joystick.

Source:
Parameters:
Name Type Description
orientation

(number) - A number in radians representing the orientation of the joystick.

layer-live

This event is triggered on each newly-live layer once it is finished loading and ready to display.

Source:
Parameters:
Name Type Description
data Object

A list of key-value pairs of data sent into this Scene from the previous Scene.

layer-loaded

This event is triggered on the layers once all assets have been readied and the layer is created.

Source:
Parameters:
Name Type Description
persistentData Object

Data passed from the last scene into this one.

Name Type Description
level Object

A level name or definition to load if the level is not already specified.

holds platypus.Data

An object that handles any holds on before making the scene live.

Name Type Description
count Number

The number of holds to wait for before triggering "scene-live"

release function

The method to trigger to let the scene loader know that one hold has been released.

layer-unloaded

This event is triggered on the layers once the Scene is over.

Source:

level-loading-progress

As a level is loaded, this event is triggered to show progress.

Source:
Parameters:
Name Type Description
message platypus.Data

Contains progress data.

Name Type Description
count Number

The number of loaded entities.

progress Number

A fraction of count / total.

total Number

The total number of entities being loaded by this component.

Called when linking a new member to the family, this event accepts a list of family members from the new member and uses it to link all the family members together.

Source:
Parameters:
Name Type Description
links Array | Entities

An array of entities.

Listeners of This Event:

load

The entity triggers load on itself once all the properties and components have been attached, notifying the components that all their peer components are ready for messages.

Source:

load-level

Dispatched when the scene has loaded and the level has been composited so TileLoader can begin loading the level.

Source:
Parameters:
Name Type Description
data Object
Name Type Description
level Object

An object describing the level dimensions, tiles, and entities.

persistentData Object

The persistent data passed from the last scene. We add levelBuilder data to it to pass on.

Name Type Description
levelTemplate Object

A 1D or 2D array of level piece ids. The template defines how the pieces will be arranged and which pieces can be used where. The template must be rectangular in dimensions.

levelPieces Object

An object of key/value pairs listing the pieces that map to an id in the level template.

useUniques Boolean

If true, no single map piece is used twice in the creation of the combined map.

Listeners of This Event:

logic-paused

Notifies children entities that logic has been paused.

Source:

logic-unpaused

Notifies children entities that logic has been unpaused.

Source:

move

Start the entity accelerating toward the heading angle.

Source:
Listeners of This Event:

mute-audio

On receiving this message all audio will mute, or a particular sound instance will mute if an id is specified.

Source:
Parameters:
Name Type Description
audioId String

If an audioId is provided, that particular sound instance will mute. Otherwise all audio is muted.

Listeners of This Event:

new-scene

On receiving this message, a new scene is loaded according to provided parameters or previously determined component settings.

Source:
Parameters:
Name Type Description
message.load String

This is a label corresponding with a predefined layer.

message.persistentData Object

Any values that should be passed to the layers' "layer-loaded" and "layer-live" events.

Listeners of This Event:

no-drop

This message comes from the collision system letting us know the object is currently in a location that it cannot be dropped.

Source:
Listeners of This Event:

north

If the soft joystick is enabled on this component, it will broadcast this directional message if the joystick is dragged due north.

Source:
Parameters:
Name Type Description
message Event

The original pointer event object is passed along with the control message.

north-northeast

If the soft joystick is enabled on this component, it will broadcast this directional message if the joystick is dragged due north-northeast.

Source:
Parameters:
Name Type Description
message Event

The original pointer event object is passed along with the control message.

north-northwest

If the soft joystick is enabled on this component, it will broadcast this directional message if the joystick is dragged due north-northwest.

Source:
Parameters:
Name Type Description
message Event

The original pointer event object is passed along with the control message.

northeast

If the soft joystick is enabled on this component, it will broadcast this directional message if the joystick is dragged due northeast.

Source:
Parameters:
Name Type Description
message Event

The original pointer event object is passed along with the control message.

northwest

If the soft joystick is enabled on this component, it will broadcast this directional message if the joystick is dragged due northwest.

Source:
Parameters:
Name Type Description
message Event

The original pointer event object is passed along with the control message.

orient-vector

On receiving a vector via this event, the component will transform the vector using the current orientation matrix and then store the vector and continue manipulating it as the orientation matrix changes.

Source:
Parameters:
Name Type Description
vector platypus.Vector

The vector whose orientation will be maintained.

Listeners of This Event:

orientation-updated

Once a transform is complete, this event is triggered to notify the entity of the completed transformation.

Source:
Parameters:
Name Type Description
matrix Array

A 3x3 2D array describing the change in orientation.

pause-audio

On receiving this message all audio will pause, or a particular sound instance will pause if an id is specified.

Source:
Parameters:
Name Type Description
audioId String

If an audioId is provided, that particular sound instance will pause. Otherwise all audio is paused.

Listeners of This Event:

pause-controls

This message will stop the controller from triggering messages until "unpause-controls" is triggered on the entity.

Source:
Listeners of This Event:

pause-logic

This component fires this message on the parent entity to pause logic if required.

Source:
Parameters:
Name Type Description
options Object
Name Type Description
time number

The amount of time to pause before re-enabling logic.

Listeners of This Event:

pause-movment

Stops all movement on the Entity.

Source:
Listeners of This Event:

pause-render

This component fires this message on the parent entity to pause rendering if required.

Source:
Parameters:
Name Type Description
options Object
Name Type Description
time number

The amount of time to pause before re-enabling render updates.

Listeners of This Event:

pause-tween

This event pauses all running tweens on this component.

Source:
Listeners of This Event:

peer-entity-added

This message is triggered when a new entity has been added to the parent's list of children entities.

Source:
Parameters:
Name Type Description
entity platypus.Entity

The entity that was just added.

peer-entity-removed

This message is triggered when an entity has been removed from the parent's list of children entities.

Source:
Parameters:
Name Type Description
entity platypus.Entity

The entity that was just removed.

Listeners of This Event:

play-animation

On entering a new animation-mapped state, this component triggers this event to play an animation.

Source:
Parameters:
Name Type Description
animation String

Describes the animation to play.

loop Boolean

Whether to loop a playing animation.

restart Boolean

Whether to restart a playing animation.

pointercancel

This event is triggered on pointer cancel.

Source:
Parameters:
Name Type Description
event DOMEvent

The original DOM pointer event.

pixiEvent PIXI.interaction.InteractionEvent

The Pixi pointer event.

x Number

The x coordinate in world units.

y Number

The y coordinate in world units.

entity platypus.Entity

The entity receiving this event.

pointerdown

This event is triggered on pointer down.

Source:
Parameters:
Name Type Description
event DOMEvent

The original DOM pointer event.

pixiEvent PIXI.interaction.InteractionEvent

The Pixi pointer event.

x Number

The x coordinate in world units.

y Number

The y coordinate in world units.

entity platypus.Entity

The entity receiving this event.

pointermove

This event is triggered on pointer move.

Source:
Parameters:
Name Type Description
event DOMEvent

The original DOM pointer event.

pixiEvent PIXI.interaction.InteractionEvent

The Pixi pointer event.

x Number

The x coordinate in world units.

y Number

The y coordinate in world units.

entity platypus.Entity

The entity receiving this event.

Listeners of This Event:

pointerout

This event is triggered on pointer out.

Source:
Parameters:
Name Type Description
event DOMEvent

The original DOM pointer event.

pixiEvent PIXI.interaction.InteractionEvent

The Pixi pointer event.

x Number

The x coordinate in world units.

y Number

The y coordinate in world units.

entity platypus.Entity

The entity receiving this event.

Listeners of This Event:

pointerover

This event is triggered on pointer over.

Source:
Parameters:
Name Type Description
event DOMEvent

The original DOM pointer event.

pixiEvent PIXI.interaction.InteractionEvent

The Pixi pointer event.

x Number

The x coordinate in world units.

y Number

The y coordinate in world units.

entity platypus.Entity

The entity receiving this event.

Listeners of This Event:

pointertap

This event is triggered on pointer tap.

Source:
Parameters:
Name Type Description
event DOMEvent

The original DOM pointer event.

pixiEvent PIXI.interaction.InteractionEvent

The Pixi pointer event.

x Number

The x coordinate in world units.

y Number

The y coordinate in world units.

entity platypus.Entity

The entity receiving this event.

pointerup

This event is triggered on pointer up.

Source:
Parameters:
Name Type Description
event DOMEvent

The original DOM pointer event.

pixiEvent PIXI.interaction.InteractionEvent

The Pixi pointer event.

x Number

The x coordinate in world units.

y Number

The y coordinate in world units.

entity platypus.Entity

The entity receiving this event.

pointerupoutside

This event is triggered on pointer up outside.

Source:
Parameters:
Name Type Description
event DOMEvent

The original DOM pointer event.

pixiEvent PIXI.interaction.InteractionEvent

The Pixi pointer event.

x Number

The x coordinate in world units.

y Number

The y coordinate in world units.

entity platypus.Entity

The entity receiving this event.

prepare-logic

This event is triggered on children entities to run anything that should occur before "handle-logic". For example, removing or adding components should happen here and not in "handle-logic".

Source:
Parameters:
Name Type Description
tick Object
Name Type Description
delta Number

The time that has passed since the last tick.

camera null | platypus.AABB

The range of the logic camera area. This is typically larger than the visible camera. This value is null if alwaysOn is set to true on this component.

entities Array

This is a list of all the logically active entities.

prepend-transform

This message performs an immediate transform of the entity by performing the transformation via a prepended matrix multiplication.

Source:
Parameters:
Name Type Description
transform Array | String

A 3x3 @D Array or a string describing a transformation.

Listeners of This Event:

pressed

This event is triggered when the button is pressed to mimic keypress events. If the button is a toggle button, this only occurs on up-to-down.

Source:
Parameters:
Name Type Description
buttonState platypus.Data

The state of the button

Name Type Description
pressed Boolean

This is true for the 'pressed' event.

released Boolean

This is false for the 'pressed' event.

triggered Boolean

This is true for the 'pressed' event.

entity platypus.Entity

The entity for which the original event occurred.

pressmove

This event is triggered on press move (drag).

Source:
Parameters:
Name Type Description
event DOMEvent

The original DOM pointer event.

pixiEvent PIXI.interaction.InteractionEvent

The Pixi pointer event.

x Number

The x coordinate in world units.

y Number

The y coordinate in world units.

entity platypus.Entity

The entity receiving this event.

pressup

This event is triggered on press up.

Source:
Parameters:
Name Type Description
event DOMEvent

The original DOM pointer event.

pixiEvent PIXI.interaction.InteractionEvent

The Pixi pointer event.

x Number

The x coordinate in world units.

y Number

The y coordinate in world units.

entity platypus.Entity

The entity receiving this event.

racing

This event is triggered when winding is finished and the entity begins racing.

Source:

release-me

This message is triggered on the current carrier, notifying them to release this entity.

Source:
Parameters:
Name Type Description
message.entity platypus.Entity

This entity, requesting to be released.

Listeners of This Event:

released

This event is triggered when the button is released, or on the down-to-up change for toggle buttons.

Source:
Parameters:
Name Type Description
buttonState platypus.Data

The state of the button

Name Type Description
pressed Boolean

This is false for the 'released' event.

released Boolean

This is true for the 'released' event.

triggered Boolean

This is false for the 'released' event.

entity platypus.Entity

The entity for which the original event occurred.

relocate

The camera listens for this event to change its position in the world.

Source:
Parameters:
Name Type Description
location Vector | Object

List of key/value pairs describing new location

Name Type Attributes Description
x Number

New position along the x-axis.

y Number

New position along the y-axis.

time Number <optional>

The time to transition to the new location.

ease function <optional>

The ease function to use. Defaults to a linear transition.

Listeners of This Event:

relocate-entity

This message causes the entity's x,y coordinates to update. (Usually after collision checks, but can be used to avoid collision checks during logic handling.)

Source:
Parameters:
Name Type Attributes Description
location Object | platypus.Vector

The new coordinates.

Name Type Attributes Default Description
position platypus.Vector <optional>

If specified, this vector is used instead of the passed-in object as the location.

relative boolean <optional>
false

Determines whether the provided x,y coordinates are relative to the entity's current position.

unstick platypus.Vector <optional>
null

Where the entity should be moved to unstick from collision contact.

relative <optional>

If location.relative is not specified, this parameter is also checked.

remove-collision-entity

On receiving 'collide-off', this message is triggered on the parent to turn off collision.

Source:
Parameters:
Name Type Description
entity platypus.Entity

The entity this component is attached to.

remove-vector

On receiving this message, the maintained vector is immediately dropped from the list of maintained vectors.

Source:
Parameters:
Name Type Description
vector platypus.Vector

The vector to be removed.

Listeners of This Event:

render-paused

Notifies children entities that rendering updates have been paused.

Source:

render-unpaused

Notifies children entities that rendering updates have been unpaused.

Source:

render-update

Sends a 'handle-render' message to all the children in the Container. This bypasses a render pause value and is useful for resizes happening outside the game loop.

Source:
Parameters:
Name Type Description
tick Object

An object containing tick data.

Listeners of This Event:

render-world

Once the entity is loaded, this component triggers "render-world" to notify other components about the entities' display container.

Source:
Parameters:
Name Type Description
data Object
Name Type Description
world PIXI.Container

Contains entities to be rendered.

Listeners of This Event:

replace-transform

This message performs an immediate transform of the entity by returning the entity to an identity transform before performing a matrix multiplication.

Source:
Parameters:
Name Type Description
transform Array | String

A 3x3 @D Array or a string describing a transformation.

Listeners of This Event:

request

On receiving this message, this component makes a request from the server using the provided information. Note that properties set here will reset the properties set by this component's JSON definition.

Properties:
Properties
Name Type Description
message Object
Name Type Attributes Default Description
method String

XHR method to use: must be "GET" or "POST".

path String

The path to the server resource.

responseType String <optional>
"text"

Response type expected.

data Object <optional>

An object of string key/value pairs to be transmitted to the server.

onload function

A function that should be run on receiving a response from the server. This defaults to triggering a "response" message containing the responseText value.

Source:
Listeners of This Event:

resize-camera

The camera listens for this event to change its world viewport size.

Source:
Parameters:
Name Type Attributes Description
dimensions Object <optional>

List of key/value pairs describing new viewport size

Name Type Description
width number

Width of the camera viewport

height number

Height of the camera viewport

time number

Time in millseconds over which to tween the scale change.

forceUpdate Boolean <optional>

Whether to update graphics.

Listeners of This Event:

response

This message is triggered on receiving a response from the server (if "onload" is not set by the original "request" message).

Source:
Parameters:
Name Type Description
message String

The message contains the responseText returned by the server.

rotate

This rotates the entity by a delta in radians.

Source:
Parameters:
Name Type Description
angleDelta Number

The change in angle.

sequence-complete

When an audio sequence is finished playing, this event is triggered.

Source:
Listeners of This Event:

set-angle

Sets the internal heading angle in the component.

Source:
Parameters:
Name Type Description
angle Number

The value you want to set the angle to.

Listeners of This Event:

set-hit-area

Sets the hit area for interactive responses by describing the dimensions of a clickable rectangle:

"hitArea": {
    "x": 10,
    "y": 10,
    "width": 40,
    "height": 40
}

Or a circle:

"hitArea": {
    "x": 10,
    "y": 10,
    "radius": 40
}

Or use an array of numbers to define a polygon: [x1, y1, x2, y2, ...]

"hitArea": [-10, -10, 30, -10, 30, 30, -5, 30]

Defaults to the container if set to null.

Source:
Parameters:
Name Type Description
shape Object
Listeners of This Event:

set-mask

Defines the mask on the container/sprite. If no mask is specified, the mask is set to null.

Source:
Parameters:
Name Type Description
mask Object

The mask. This can specified the same way as the 'mask' parameter on the component.

Listeners of This Event:

set-max-velocity

Set the max velocity.

Source:
Parameters:
Name Type Description
newMaxV Number

The max velocity value.

Listeners of This Event:

set-mix-times

This sets the mix times.

Source:
Parameters:
Name Type Description
mixTimes Object

This matches the syntax required for this component's mixTimes property

Listeners of This Event:

set-motion

This event modifies the properties of this Motion.

Source:
Parameters:
Name Type Description
motion Object

A list of key/value pairs corresponding to motion values.

Name Type Attributes Description
maxMagnitude Number <optional>

A value describing the maximum velocity or acceleration the motion vector can exert on the Entity.

Listeners of This Event:

set-mover

Update mover properties.

Source:
Parameters:
Name Type Description
mover Object
Name Type Attributes Description
maxMagnitude Number | Object <optional>

New maximums for magnitude.

magnitude Number <optional>

Delta for the change in maximums.

Listeners of This Event:

set-pan

This message sets the pan of playing audio.

Source:
Parameters:
Name Type Attributes Description
pan Number

A number from -1 to 1 that sets the pan.

soundId String <optional>

If an soundId is provided, that particular sound instance's pan is set.

Listeners of This Event:

set-persistent-scene-data

On receiving this message, persistent data is stored, waiting for a new-scene to make the transition.

Source:
Parameters:
Name Type Description
persistentData Object

Any values that should be passed to the next scene via the "layer-loaded" and "layer-live" events.

Listeners of This Event:

set-scene

On receiving this message, a scene value is stored, waiting for a new-scene to make the transition.

Source:
Parameters:
Name Type Description
scene String

This is a label corresponding with a predefined scene.

Listeners of This Event:

set-speed

This message sets the speed of playing audio.

Source:
Parameters:
Name Type Attributes Description
speed Number

A number that sets the speed.

soundId String <optional>

If an soundId is provided, that particular sound instance's speed is set. Otherwise all audio speed is changed.

Listeners of This Event:

set-target

On receiving this message, the component will change its target and begin chasing the new entity.

Source:
Parameters:
Name Type Description
entity platypus.Entity

Sets this entity's target to the provided entity.

Listeners of This Event:

set-target-offset

On receiving this message, the component will change its target offset.

Source:
Parameters:
Name Type Description
offset Object | Vector

Sets the chased entity's offset to the provided offset.

Name Type Description
x number

The offset along the x-axis.

y number

The offset along the y-axis.

Listeners of This Event:

set-text

Sets the copy of the text.

Source:
Parameters:
Name Type Description
text String

The text to insert.

Listeners of This Event:

set-timer

Sets time for alarm.

Source:
Parameters:
Name Type Description
data.time Number

Time to set for alarm.

Listeners of This Event:

set-volume

This message sets the volume of playing audio.

Source:
Parameters:
Name Type Attributes Description
volume Number

A number from 0 to 1 that sets the volume.

soundId String <optional>

If an soundId is provided, that particular sound instance's volume is set. Otherwise all audio volume is changed.

Listeners of This Event:

shake

On receiving this message, the camera will shake around its target location.

Source:
Parameters:
Name Type Description
shake Object
Name Type Attributes Description
xMagnitude number <optional>

How much to move along the x axis.

yMagnitude number <optional>

How much to move along the y axis.

xFrequency number <optional>

How quickly to shake along the x axis.

yFrequency number <optional>

How quickly to shake along the y axis.

time number <optional>

How long the camera should shake.

Listeners of This Event:

show

This event makes the spine visible.

Source:
Listeners of This Event:

show-sprite

This event makes the sprite visible.

Source:
Listeners of This Event:

south

If the soft joystick is enabled on this component, it will broadcast this directional message if the joystick is dragged due south.

Source:
Parameters:
Name Type Description
message Event

The original pointer event object is passed along with the control message.

south-southeast

If the soft joystick is enabled on this component, it will broadcast this directional message if the joystick is dragged due south-southeast.

Source:
Parameters:
Name Type Description
message Event

The original pointer event object is passed along with the control message.

south-southwest

If the soft joystick is enabled on this component, it will broadcast this directional message if the joystick is dragged due south-southwest.

Source:
Parameters:
Name Type Description
message Event

The original pointer event object is passed along with the control message.

southeast

If the soft joystick is enabled on this component, it will broadcast this directional message if the joystick is dragged due southeast.

Source:
Parameters:
Name Type Description
message Event

The original pointer event object is passed along with the control message.

southwest

If the soft joystick is enabled on this component, it will broadcast this directional message if the joystick is dragged due southwest.

Source:
Parameters:
Name Type Description
message Event

The original pointer event object is passed along with the control message.

start-acceleration

This event sets the acceleration to active.

Source:
Listeners of This Event:

start-chasing

On receiving this message, the component will begin chasing the entity.

Source:
Parameters:
Name Type Attributes Description
entity platypus.Entity <optional>

Sets the entity if it's provided.

Listeners of This Event:

start-timer

Starts the timer's countdown.

Source:
Listeners of This Event:

start-velocity

This event sets the velocity to active.

Source:
Listeners of This Event:

state-changed

Triggered on entities when the entity's state has been changed.

Source:
Parameters:
Name Type Description
state Object

A list of key/value pairs representing the owner's state (this value equals entity.state).

stop

Stops motion in all directions until movement messages are again received.

Source:
Parameters:
Name Type Attributes Description
message.pressed boolean <optional>

If message is included, the component checks the value of pressed: a value of false will not stop the entity.

stop-acceleration

This event sets the acceleration to inactive.

Source:
Listeners of This Event:

stop-active-timelines

Stops all timelines.

Source:
Listeners of This Event:

stop-animation

On attaining an animation-mapped state, this component triggers this event to stop a previous animation.

Source:
Parameters:
Name Type Description
animation String

Describes the animation to stop.

stop-audio

On receiving this message, audio will stop playing.

Source:
Parameters:
Name Type Description
audioId String

If an audioId is provided, that particular sound instance is stopped. Otherwise all audio is stopped.

stop-chasing

On receiving this message, the component will cease chasing the entity.

Source:
Listeners of This Event:

stop-moving

Stops linear motion until movement messages are again received.

Source:
Parameters:
Name Type Attributes Description
state.pressed Boolean <optional>

If state is included, the component checks the value of pressed: a value of false will not stop the entity.

stop-racing

Causes the entity to stop racing.

Source:
Listeners of This Event:

stop-timer

Stops the timer's countdown. If resetOnStop is true, resets timer.

Source:
Listeners of This Event:

stop-turning

Stops rotational motion until movement messages are again received.

Source:
Parameters:
Name Type Attributes Description
state.pressed Boolean <optional>

If state is included, the component checks the value of pressed: a value of false will not stop the entity.

stop-tween

This event stops all running tweens on this component.

Source:
Listeners of This Event:

stop-velocity

This event sets the velocity to inactive.

Source:
Listeners of This Event:

stopped-racing

This event is triggered when the entity stops racing.

Source:

stopped-winding

This event is triggered when the entity stops winding.

Source:

tick

This event is triggered on the game as well as each layer currently loaded.

Source:
Parameters:
Name Type Description
tickMessage Object

Event tracking tick data. This object is re-used for subsequent ticks.

Name Type Description
delta Number

Time in MS passed since last tick.

elapsed Number

Time in MS passed since game load.

toggle-disabled

Toggles whether the entity is disabled.

Source:
Listeners of This Event:

toggle-highlight

Toggles the entity's highlighted state.

Source:
Listeners of This Event:

toggle-mute

On receiving this message, the audio will mute if unmuted, and unmute if muted.

Source:
Parameters:
Name Type Description
audioId String

If an audioId is provided, that particular sound instance is toggled. Otherwise all audio is toggled from mute to unmute or vice versa.

Listeners of This Event:

transform

This message performs an immediate transform of the entity by performing the transformation via a prepended matrix multiplication.

Source:
Parameters:
Name Type Description
transform Array | String

A 3x3 @D Array or a string describing a transformation.

turn-around

On receiving this message, the component will check the collision side and re-orient itself accordingly.

Source:
Parameters:
Name Type Description
collisionInfo platypus.CollisionData

Uses direction of collision to determine whether to turn around.

Listeners of This Event:

turn-left

On receiving this event, the entity turns left.

Source:
Parameters:
Name Type Attributes Description
state.pressed boolean <optional>

If state is included, the component checks the value of pressed: true causes movement in the triggered direction, false turns off movement in that direction. Note that if no message is included, the only way to stop movement in a particular direction is to trigger stop on the entity before progressing in a new orientation.

turn-right

On receiving this event, the entity turns right.

Source:
Parameters:
Name Type Attributes Description
state.pressed boolean <optional>

If state is included, the component checks the value of pressed: true causes movement in the triggered direction, false turns off movement in that direction. Note that if no message is included, the only way to stop movement in a particular direction is to trigger stop on the entity before progressing in a new orientation.

tween

Trigger this event to play a tween using the same spec used for a tween on this component's events property.

Source:
Parameters:
Name Type Description
tween Object | Array
Listeners of This Event:

tween-transform

This message performs a timed transform of the entity by performing the transformation via a prepended matrix multiplication.

Source:
Parameters:
Name Type Description
transform Array | String

A 3x3 @D Array or a string describing a transformation.

Listeners of This Event:

unhighlight

Sets the entity's highlighted state to false.

Source:
Listeners of This Event:

unload-layer

This event is triggered on the layer to allow children of the layer to place a hold on the closing until they're ready.

Source:
Parameters:
Name Type Description
data Object

A list of key-value pairs of data sent into this Scene from the previous Scene.

hold function

Calling this function places a hold; release must be called to release this hold and unload the layer.

release function

Calling this function releases a previous hold.

unmute-audio

On receiving this message all audio will unmute, or a particular sound instance will unmute if an id is specified.

Source:
Parameters:
Name Type Description
audioId String

If an audioId is provided, that particular sound instance will unmute. Otherwise all audio is unmuted.

Listeners of This Event:

unpause-audio

On receiving this message all audio will unpause, or a particular sound instance will unpause if an id is specified.

Source:
Parameters:
Name Type Description
audioId String

If an audioId is provided, that particular sound instance will unpause. Otherwise all audio is unpaused.

Listeners of This Event:

unpause-controls

This message will allow the controller to trigger messages until "pause-controls" is triggered on the entity.

Source:
Listeners of This Event:

unpause-movment

Unpauses all movement on the Entity.

Source:
Listeners of This Event:

unpause-tween

This event unpauses all running tweens on this component.

Source:
Listeners of This Event:

update-animation

This event is triggered each tick to check for animation updates.

Source:
Parameters:
Name Type Description
playing Boolean

Whether the animation is in a playing or paused state.

Listeners of This Event:

update-content

A call used to notify other components that the count or total has changed.

Source:
Parameters:
Name Type Description
update.text string

String describing the current count.

west

If the soft joystick is enabled on this component, it will broadcast this directional message if the joystick is dragged due west.

Source:
Parameters:
Name Type Description
message Event

The original pointer event object is passed along with the control message.

west-northwest

If the soft joystick is enabled on this component, it will broadcast this directional message if the joystick is dragged due west-northwest.

Source:
Parameters:
Name Type Description
message Event

The original pointer event object is passed along with the control message.

west-southwest

If the soft joystick is enabled on this component, it will broadcast this directional message if the joystick is dragged due west-southwest.

Source:
Parameters:
Name Type Description
message Event

The original pointer event object is passed along with the control message.

wind-up

Causes the entity to wind up for a race.

Source:
Parameters:
Name Type Description
message.pressed Boolean

If message is included, the component checks the value of pressed: false causes winding to stop.

Listeners of This Event:

winding

This event is triggered as the entity winds up.

Source:
Parameters:
Name Type Description
fraction Number

The amount of progress that has been made from 0 to 1.

world-loaded

Once finished loading the map, this message is triggered on the entity to notify other components of completion.

Source:
Parameters:
Name Type Description
message platypus.Data

World data.

Name Type Description
level Object

The Tiled level data used to load the level.

width number

The width of the world in world units.

height number

The height of the world in world units.

tile platypus.AABB

Dimensions of the world tiles.

world platypus.AABB

Dimensions of the world.

camera platypus.Entity

If a camera property is found on one of the loaded entities, this property will point to the entity on load that a world camera should focus on.

lazyLoads Array

List of objects representing entity definitions that will await camera focus before generating actual entities.

Listeners of This Event:

joystick:down

This event is triggered when there is an active touch in the joystick area.

Source:
Parameters:
Name Type Description
message Event

The original pointer event object is passed along with the control message.

joystick:up

This event is triggered when there is an active touch is released from the joystick area.

Source:
Parameters:
Name Type Description
message Event

The original pointer event object is passed along with the control message.

mouse:mouse-left:down

This component triggers the state of mouse inputs on the entity if a render component of the entity accepts mouse input.

Source:
Parameters:
Name Type Description
message Event

The original mouse event object is passed along with the control message.

mouse:mouse-left:up

This component triggers the state of mouse inputs on the entity if a render component of the entity accepts mouse input (for example [[Render-Animation]]).

Source:
Parameters:
Name Type Description
message Event

The original mouse event object is passed along with the control message.

mouse:mouse-middle:down

This component triggers the state of mouse inputs on the entity if a render component of the entity accepts mouse input (for example [[Render-Animation]]).

Source:
Parameters:
Name Type Description
message Event

The original mouse event object is passed along with the control message.

mouse:mouse-middle:up

This component triggers the state of mouse inputs on the entity if a render component of the entity accepts mouse input (for example [[Render-Animation]]).

Source:
Parameters:
Name Type Description
message Event

The original mouse event object is passed along with the control message.

mouse:mouse-right:down

This component triggers the state of mouse inputs on the entity if a render component of the entity accepts mouse input (for example [[Render-Animation]]).

Source:
Parameters:
Name Type Description
message Event

The original mouse event object is passed along with the control message.

mouse:mouse-right:up

This component triggers the state of mouse inputs on the entity if a render component of the entity accepts mouse input (for example [[Render-Animation]]).

Source:
Parameters:
Name Type Description
message Event

The original mouse event object is passed along with the control message.