Pin behavior

The Pin behavior positions an object at a relative distance and angle to another object, giving the impression it has been "pinned" to the object. For examples, search for Pin in the Start dialog.

Simply adding the Pin behavior to an object does not do anything. You must use the Pin action to pin the object to another object.

Pin conditions

Is pinned
True if the object is currently pinned to another object.

Pin actions

Pin to object
Pin the object to another object. The relative distance and angle between the objects at the moment the Pin action is used is remembered. The Mode parameter chooses how the object is moved in relation to the other object:
Position & angle (default): keep the object at its relative distance and angle to the pinned object. The object will appear attached and stay in place as the other object moves and rotates.
Position only: as before, but the object angle is not changed; it only maintains its relative position.
Angle only: the object is only rotated relative to the other object, and does not have its position changed.
Rope style: the object is not rotated, but is kept at a maximum distance from the other object.
Bar style: the object is not rotated, but is kept at a fixed distance from the other object.
For more examples, see the Pin rope style.capx and Pin chain style.capx examples in the Examples folder in Construct 2's install directory.

Unpin
Unpin the object, so it is no longer being positioned by the Pin behavior.

Pin expressions

PinnedUID
Get the UID of the object currently pinned to, or -1 if not pinned. For more information on UIDs, see common features.

Tags: