Create Object Instance


Description

With this action you can create an instance of any object from the resource tree. You give the name of the object and an x/y position within the room where it is to be created. You can tick the "relative" flags to position the instance relative to the instance running the action code blocks. Whenever you create an instance in the game, it is given a unique ID value with which you can then identify the instance in further actions, therefore this action permits you to define a "target" variable to hold this ID value (as shown in the example below). Note that the target can be flagged as a temporary (local) variable, which will be created for the action and can be used in all subsequent actions.


Action Syntax:

Create Object Instance Syntax


Arguments:

Argument Description
Object The name of the object to create an instance of.
x The x position in the room to create the instance (can be relative to the calling instance).
y The y position in the room to create the instance (can be relative to the calling instance)
Target The variable to target for the return value.


Example:

Create Instance Example
The above action block code creates a new instance and stores its unique ID value in a temporary variable. This variable is then used in the Applies To... action to set some properties of the instance created.