Construct 3 icon

Construct 3

Documentation

Common expressions

Ashley's avatar
Medal
Construct Team Founder
Published 23 Aug, 2017
415 words
~2-3 mins

The following expressions are common to several plugins.

Angle

Angle

The object's current angle, in degrees. 0 degrees is facing right and angles increment clockwise.

Appearance

Opacity

The object's current opacity (semitransparency), from 0 (transparent) to 100 (opaque).

Misc

AsJSON

Save the object state to a string of data in JSON format, and return it. This can be downloaded or otherwise stored, and later the state of the object restored using the Set from JSON action.

Count

The number of instances of the object type.

PickedCount

The number of instances meeting the event's conditions. For example, if the event has the condition "Mouse is over Sprite", Sprite.PickedCount will return the number of Sprite instances that the mouse is over.

ObjectTypeName

The name of the object type for the given object. For example Sprite.ObjectTypeName will return "Sprite". When used as a family expression, this returns the name of the actual object type, never the name of the family itself.

IID

Return the instance's index ID (IID). See instances.

UID

Return the instance's unique ID (UID). See instances.

Size & Position

BBoxLeft

BBoxRight

BBoxTop

BBoxBottom

Return the layout co-ordinates of the object's axis-aligned bounding box. This is the smallest unrotated box that completely encloses the object, taking in to account any rotation or stretching.

Width

Height

Return the size of the object in pixels.

ImagePointX(nameOrNumber)

ImagePointY(nameOrNumber)

Return the position of one of the object's image points from its currently displaying animation frame in layout co-ordinates. Either the image point's name or its number can be passed.

X

Y

Return the object's position in the layout, in pixels. The origin (0,0) is at the top-left of the layout and the Y axis increments downwards.

Time

dt

Return delta-time according to the object's own timescale. See Delta-time and framerate independence for more information.

Z Order

LayerName

The name of the layer the instance is currently on.

LayerNumber

The zero-based index of the layer the instance is currently on.

ZElevation

Return the current elevation on the Z axis for the instance relative to its layer. This is not affected by the layer's Z elevation.

TotalZElevation

Return the instance's Z elevation added to the layer's Z elevation, providing the total Z elevation the instance appears at.

ZIndex

Get the zero-based index of the Z order of this instance within its current layer. 0 is the bottom instance, increasing up to the top instance.