Construct 3 icon

Construct 3

Documentation

System actions

Published 22 Aug, 2017
2,187 words
~9-15 mins

This section describes all the actions in the built-in System object in Construct. They are listed in the order they appear in the Add Action dialog.

Display

Set canvas size

Set the size of the canvas area in the page, if appearing inline to the page (i.e. a fullscreen mode is not used). If a fullscreen mode is in use, this effectively changes the size of the Viewport size project property, which adjusts the size of the viewport.

Set fullscreen scaling

Set the Fullscreen quality project property. This allows the quality setting to be adjusted at runtime.

Set pixel rounding

Set the Pixel rounding project property at runtime.

Snapshot canvas

Take a screenshot of the current display. This triggers On canvas snapshot when the snapshot is ready, and the resulting image can be accessed with the CanvasSnapshot system expression. This can then be loaded in to a sprite or tiled background, sent to a server, or opened with the Browser object in a new tab.

General

Create object

Create a new instance of an object type on a layer at a given position. If a family is chosen, a random object type from the family is picked, and an instance created for that.

Create object (by name)

As with Create object, but allows using a string of the name of the object type to create. This allows using an expression to dynamically pick which kind of object to create. The Pick last created condition is sometimes useful to pick the resulting instance in a sub-event.

Reset persisted objects

Across the entire project, reset all objects using the Persist behavior to their initial state (as if the layout has not been visited yet). This is useful when restarting a new game from the beginning again.

Set group active

Set an event group active or inactive. None of the events in an inactive group run until it is activated again. The event group is identified by its name.

Sort Z order

Sort the Z order of instances of a given object according to an instance variable. This effectively removes all instances from their Z order, sorts them, then inserts the sorted sequence back in to the holes left behind. This means if the instances are spread across a range of layers, they will be sorted in the same Z order locations, maintaining the same order relative to other instances on those layers. Note this action is much faster than using an ordered For each with an action like Send to front/back, so this action should be the preferred way to sort the Z order of large numbers of instances.

Stop loop

Stop a Repeat, For or For each loop currently running. These loops are system conditions. The rest of the event's actions and subevents will still complete, but the loop will not run any further after that.

Global & local variables

Add to

Subtract from

Set value

Alter the value stored by a number or text type global or local variable.

Reset global variables

Reset all the global variables in the project to their initial value.

Set boolean

Toggle boolean

Set or toggle a boolean type global or local variable.

Layers

For more information about the effect actions, see Effects.

Set layer angle

Rotate an entire layer by a number of degrees.

Set layer background color

Set the background color of a layer. Note if the layer is transparent, setting the background won't change the appearance unless you also make the layer opaque.

Set layer blend mode

Set the blend mode of a layer. See the Effects section for a description of the available blend modes.

Set layer effect enabled

Enable or disable one of the effects added to a layer on the current layout. This action cannot be used to alter layers from other layouts.

Set layer effect parameter

Change the value of one of the parameters for an effect added to a layer on the current layout. This action cannot be used to alter layers from other layouts. 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. To set the value of a color parameter, use the rgb system expression.

Set layer force own texture

Change a layer's Force own texture property at runtime. For more information see the property in the Layers manual entry.

Set layer opacity

Set the opacity (or semitransparency) of an entire layer.

Set layer parallax

Set the horizontal and vertical parallax rates of a layer.

Set layer scale

Set the scale (or zoom) of an entire layer, taking in to account its scale rate property.

Set layer scale rate

Set the scale rate property of a layer, which affects how quickly it scales (if at all).

Set layer transparent

Set the transparent property of a layer. If transparent, the background color is ignored.

Set layer visible

Show or hide an entire layer.

Layout

Go to layout

Go to layout (by name)

Switch to another layout in the project. Note that global variables keep their current value - they are not reset. To reset them use the system action Reset global variables.

Go to next/previous layout

Switch to the next or previous layout in the project. The order as they appear in the Project Bar is used, where layouts at the top are first and layouts at the bottom are last. If on the first layout, trying to go to the previous layout does nothing, and if on the last layout, trying to go to the next layout does nothing. Note that global variables keep their current value - they are not reset. To reset them use the system action Reset global variables.

Recreate initial objects

Recreate the objects in a rectangular area of the layout as they appear in the Layout View. In other words, this restores a section of the initial level design. Note that this does not destroy any existing objects, so if used repeatedly will create multiple objects sitting on top of each other. Only objects of the given type are created, or alternatively a family can be passed and all objects belonging to that family are recreated.

Restart layout

Restart the current layout. Note that unlike Go to layout, this action resets all event groups to their initial activation state. Global variables keep their current value - they are not reset. To reset them use the system action Reset global variables.

Set layout angle

Rotate an entire layout by a number of degrees. This rotates all the layers in the layout.

Set layout effect enabled

Enable or disable one of the effects added to the current layout. This action cannot be used to alter other layouts.

Set layout effect parameter

Change the value of one of the parameters for an effect added to the current layout. This action cannot be used to alter other layouts. 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. To set the value of a color parameter, use the rgb system expression.

Set layout scale

Set the scale (or zoom) of an entire layout. This scales all the layers in the layout, taking in to account their scale rate property.

Memory management

By default Construct loads and releases memory automatically, so normally you do not need to worry about how memory is managed in your game. However very large projects may need to control when objects are loaded in to and released from memory. These actions provide control over the loaded image memory. Note that spritesheeting combines different images on to the same spritesheets; the spritesheet will be loaded in to memory if any single image on it is loaded, and only released when no images on it are loaded.

Load layout images

Load layout images (by name)

Load all the images used by a layout in to memory. The layout can be chosen either from a list or using a string of its name.

Load object images

Load object images (by name)

Load all the images used by an object in to memory. The object can be chosen either by an object picker or a string of its name. If it's already loaded, this has no effect.

Unload object images

Unload object images (by name)

Unload all the images used by an object from memory. The object can be chosen either by an object picker or a string of its name. If it is not yet loaded, this has no effect. If there are still instances of the object in use (i.e. the object's instance count is greater than 0), then this has no effect, since the images are still in use and cannot yet be released.

Unload unused images

Automatically unload the images for any objects that have their images loaded, but currently have had all their instances destroyed (so the instance count is 0).

Save & Load

Load

Load the state of the game from a save slot. When done, triggers On load complete, or On load failed if the save slot has not been saved to before. For more information see How to make savegames.

Load from JSON

Load the state of the game from a string of JSON data previously returned by the SaveStateJSON system expression. For more information see How to make savegames.

Save

Save the state of the game to a save slot. When done, triggers On save complete. For more information see How to make savegames.

Scrolling

To scroll, the size of the layout must be bigger than the size of the viewport, or the layout's Unbounded scrolling property must be enabled. Otherwise there is nowhere to scroll to and scrolling will have no effect.

Scroll to object

Center the view on a given object. This scrolls all layers taking in to account their parallax property.

Scroll to position

Scroll to X

Scroll to Y

Set the X and Y positions to center the view on. This scrolls all layers taking in to account their parallax property.

Time

Set object time scale

Restore object time scale

Change the rate time passes for a specific object. This affects the object's behaviors and its own dt expression. Restoring the object's time scale returns it to the same time scale the rest of the game is using. See the tutorial on Delta-time and framerate independence for more information.

Set minimum framerate

Set the maximum delta-time (dt) value based on a framerate. The default minimum framerate is 30 FPS, meaning the maximum dt is 1 / 30 (= 33ms). If the framerate drops below 30 FPS, dt will still not exceed 1/30. This has the effect of the game going in to slow motion as it drops below the minimum framerate, rather than objects stepping further every frame to keep up the same real-world speed. This helps avoid skipped collisions due to stepping a very large distance every frame.

Set time scale

Change the rate time passes at in the game. Useful for slow-motion or pausing effects. See the tutorial on Delta-time and framerate independence for more information.

Signal

Resume any events paused with a Wait for signal action with the given tag.

Wait

Wait a number of seconds before continuing on to the next action or sub-events. Other events continue to run in the meantime. See also the tutorial on How to use the System 'Wait' actions.

Wait for signal

Wait indefinitely until the Signal action is used with the same tag. Other events continue to run in the meantime. See also the tutorial on How to use the System 'Wait' actions.