Common actions

The following actions are common to several plugins.

Angle

Note angles in Construct 2 start with 0 degrees facing right and increment clockwise.

Rotate clockwise
Rotate the object a number of degrees clockwise.

Rotate counter-clockwise
Rotate the object a number of degrees counter-clockwise.

Rotate toward angle
Rotate the object a number of degrees toward another angle. If the object is close to the target angle it will not overshoot (it will end up exactly at the target angle).

Rotate toward position
Rotate the object a number of degrees toward a position. If the object is close to facing the target angle it will not overshoot (it will end up exactly at the target angle).

Set angle
Set the object's angle in degrees, from 0 to 360. 0 degrees is facing right and angles increment clockwise.

Set angle toward position
Set the object's angle to face a position in the layout.

Appearance

Not all objects support the actions relating to effects. For more information see Effects.

Set blend mode
Change the way the object blends with the background by altering the object's Blend mode property.

Set effect enabled
Enable or disable one of the effects added to the object.

Set effect parameter
Change the value of one of the parameters for an effect added to the object. The parameter to change is specified by its zero-based index, i.e. 0 to change the first parameter, 1 to change the second parameter, and so on.

Set opacity
Set the object's opacity (or 'semitransparency'), from 0 (transparent) to 100 (opaque).

Set visible
Set the object visible or invisible (hidden).

Instance variables

Add to
Subtract from
Modify a number instance variable.

Set
Set a number or text instance variable.

Set boolean
Set a boolean instance variable, which can hold either a true or false value.

Toggle boolean
Toggle a boolean instance variable, which flips it from true to false or vice versa.

Misc

Destroy
Remove the object from the game.

Set from JSON
Set the state of this object from a string of data in JSON format. This must come from a prior use of the AsJSON expression.

Size & Position

Move at angle
Move the object a number of pixels at a given angle in degrees.

Move forward
Move the object a number of pixels forward at the object's current angle.

Set width
Set height
Set size
Set the object's current size in pixels.

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

Set position to another object
Position the object at another object. It can also be positioned relative to an image point on the given object.

Z Order

Move to bottom
Move to top
Position the object either at the bottom or top of its current layer.

Move to layer
Move the object to the top of a given layer, either by its name or zero-based index. If the object is already on the given layer this action has no effect.

Move to object
Move the object next to another object in the Z order. You can choose to place the object to be placed in front or behind another object. If the target object is on a different layer, the object will also be moved to the target object's layer and then Z ordered next to it.

Tags: