Construct 2 is being retired on 1 Jul, 2021. We strongly recommend upgrading to Construct 3.
Object type functions
See Classes in Runtime functions for a description of plugins vs. object types vs. instances. Since SOLs (selected object lists) are based on object types, these are also documented below.
Object type properties
- A reference to the plugin the object type is from.
- Only valid when pf_texture is specified. The filename of the texture PNG file.
- Only valid when pf_texture is specified. The file size of the texture PNG file, generally used to aid the progress bar accuracy.
- Only valid when pf_animations is specified. Stores the object animations. See Sprite for an example.
- The zero-based index of the object type in the runtime's types_by_index array.
- Array of all the currently created instances of this object type.
- Array of all the behaviors added to this object type.
- #Object type functions#
- Return the first instance of this type. If in an event, this returns the first picked instance, otherwise the first instance in the instances array. Returns null if no instances exist or are picked.
- inst must be from another object type. Return the instance of this object type that corresponds to inst.
- Returns the current SOL object. See below.
The SOL (selected object list) is the list of all instances currently matching the event. Conditions filter instances matching the condition from the full instance list. In an action, condition or expression, you may wish to access this list (e.g. for static conditions). getCurrentSol() on the object type returns its SOL object, which is documented here.
Remember you must not modify the SOL for any object types other than:
- the current object type in a condition, or
- any object type passed in an object parameter.
You may have read-only access to all other SOLs, though.
- Reference to the object type the SOL is for.
- Array of the instances currently matching the event. If sol.select_all is true, this is ignored and may have undefined contents (e.g. arbitrary instances left over from a previous event). Therefore, only use this when sol.select_all is false.
- If true, this specifies that sol.instances must be ignored and sol.type.instances used (the list of all instances). If false, this indicates the contents of sol.instances is the current selection. If setting from true to false, you must clear sol.instances and fill it with your intended content.
- Returns true if the object type has at least one instance and select_all is true, or if the SOL instances array is not empty and select_all is false, else false.
- Returns a reference to the current array of instances. If select_all is true, this is the type's array of all instances. If false, this is the SOL's current instances list.
- If select_all is true, sets it to false and picks inst. Otherwise, ensures inst is in the SOL instances array. Note: avoid this function where possible, since it runs in O(n) time and will be slow for large projects.
You are here:
Search this manual:
This manual entry was last updated on 5 Jun, 2020 at 11:50