Construct 2 has been officially retired. Now you should upgrade to Construct 3.

Instance functions

Instances are generally plugin-defined. You should read the sources of a plugin to see how it is implemented. However, Construct 2 guarantees the presence of certain properties and functions. These common properties and functions are documented here. Note any properties or functions relating to objects in a layout (e.g. x, y) are not present in non-layout objects.

Common instance properties

Reference to the instance's object type.
inst.uid (read-only)
The instance's unique ID. Construct 2 issues the first instance a UID of 0 and increments by 1 for each new instance created. UIDs must never change through the life of an object.
Array of instance variables. Each element is an ordinary javascript value corresponding to the current value of the instance variable at that index.
The current position of the instance in the layer. If changed, you must call inst.set_bbox_changed().
The current size of the instance, in pixels. If changed, you must call inst.set_bbox_changed().
The current object angle, in radians. Not all objects support an angle, e.g. Text object. If changed, you must call inst.set_bbox_changed().
The current object opacity, from 0 (transparent) to 1 (opaque). Not all objects use the opacity.
Current position of the hotspot, in texture co-ordinates (e.g. (0.5, 0.5) will be a centered hotspot).
A cr.rect representing the instance's axis aligned bounding box. You must call inst.update_bbox() before using this property.
A cr.quad representing the instance's bounding quad. You must call inst.update_bbox() before using this property.
A boolean indicating if the object is currently visible.
A reference to the layer the object is on, if a world object.
Array of instances of each behavior added to the object type.
In behavior instances only: this is the reference to the object instance your behavior should modify.

Common instance functions

You must call this to indicate to Construct 2 that the object's bounding box has changed, after modifying the x, y, width, height or angle properties.
You must call this before accessing the bbox or bquad members of an instance. Otherwise, their values will be invalid.
Calls f(inst) whenever set_bbox_changed() is called on inst. Warning: this can cause a large performance overhead, so use with care.
Get the Instance ID (IID). This is the zero-based index in the object type's instances array where this instance is located. Note: you must use this function to get the IID, since IIDs are lazily assigned.
Overridden to return a string in the format "inst:Type[#]uid" e.g. "inst:Player[#]0".
Construct 2 Javascript SDK Manual 2020-06-05