top of page

Self Function

The Self Function behavior is specifically designed to extend the editor and engine to implement instance based methods or functions, for games built in Construct 3 and Construct 2.


The Self Function behavior allows you to extend a world object's features using only the event sheet. This allows you to create event based behaviors and extend the functionality of the object and its instances without having to write JavaScript or add any additional plugins. While also lessening your event sheet count, and improving event sheet readability and maintainability.


The Self Function behavior includes all the built-in function features of both Construct 3 and Construct 2, but with additional instance context features and optimizations.

PlayFab API v2.png

Introduction

Step 1.png

The Construct Master Collection has plugins that extends the editor and engine features of both Construct 3 and Construct 2.


Please click here to learn more about Game.

Features


The Self Function behavior is specifically designed to extend the editor and engine to implement instance based methods or functions, for games built in Construct 3 and Construct 2.


The Self Function behavior allows you to extend a world object's features using only the event sheet. This allows you to create event based behaviors and extend the functionality of the object and its instances without having to write JavaScript or add any additional plugins. While also lessening your event sheet count, and improving event sheet readability and maintainability.


The Self Function behavior includes all the built-in function features of both Construct 3 and Construct 2, but with additional instance context features and optimizations.


Here are some of the game features of the game plugin:

  • Self function

  • Create instance methods

  • Per instance based function implementations.

  • Inherits selected instances from calling function.

    • Useful for dynamic assigning and filtering of instances.

    • Selected Object Instances support

  • Extend or reuse the SOL (Selected Objects List) of the calling function.

  • Call instance methods

    • Pass instance method parameters

  • Call instance methods in expressions.

    • Pass instance method parameters in expression variadic parameters.

  • Call instance methods in array form

    • Pass instance method parameters in array format.

      • Parameters are separated by a separator string.

  • Return values for expression method calls.

  • Multiple method callback event triggers support.

    • Compare parameters condition.

  • Expressions

    • Call instance method with return value.

    • Parameter dictionary

    • Parameter count

    • Return value

  • Designed after the original Function plugin of Construct 3 and Construct 2.

  • Performance tested, as fast and efficient as the event sheet's performance, with no performance overhead.

  • Well maintained and fully tested for production release.

For more information about game project features, please click here to read the introductory lessons to Game.


Platform Integration


Here are some of the platforms that are natively supported:

  • All platforms supported by Construct 3.

  • All platforms supported by Construct 2.

  • Web

  • Mobile Web

  • Desktop

  • Android

  • iOS


Build Support


Here are some of the supported build options:

  • Web

  • Desktop

    • NW.js

    • Windows (WebView2)

    • macOS (WKWebView)

  • Mobile

  • Construct 3 Build Service

  • Facebook Instant Games

  • Playable Ad

  • Construct Arcade


Editor Features


Here are some of the features in the Construct editor:

  • Construct 3

  • Construct 2

Introduction
Features

How to use?

It is easy to use the Self Function behavior, you will only need to follow the steps below.

1. The first step is to add any world object in your Construct 3 or Construct 2 project. Then place a world object instance in a layout.

  • Object in Construct 3 or Construct 2 is an entity you can see in your project bar, specifically in the Object types folder.


2. The second step is to click the Edit Behaviors button in the newly added object's properties. This will launch the Object behaviors dialog of the currently selected world object instance.



3. The third step is to click the Add new behavior button in the newly launched Object behaviors dialog.



4. Finally, add the Self Function behavior, to include its features in the currently selected object and its object instances.

Instructions
Documentation

Documentation

There is currently nothing to show, we will add more in the future.



Construct 3 Scripting


The Self Function behavior has support for Construct 3's scripting feature. Click to learn more about the scripting feature. Also, check out our scripting demo projects in the bottom-most section of the documentation page, to learn more about the Self Function behavior's implementation with scripting.


  • Call(functionName, ...parameters) Self Function Call trigger, fired by a unique name in the event sheet. Instances are selected from the action it was called. This will also return a value, if set. Example: const value = runtime.objects.Sprite.getFirstPickedInstance().behaviors.Self.Call("functionName", param1, param2);

  • Return(returnValue) In an On Self Function event, set the return value. Example: runtime.objects.Sprite.getFirstPickedInstance().behaviors.Self.Return = "Return Value";

  • Return Retrieve the current return value. Example: const value = ​runtime.objects.Sprite.getFirstPickedInstance().behaviors.Self.Return;


  • Params Retrieve the current list of parameters, in an array. Example: const params = ​runtime.objects.Sprite.getFirstPickedInstance().behaviors.Self.Params;

ACEs

Actions, Conditions & Expressions

Actions

The following action groups:

  • Default Parameters

  • Input Parameters

  • Universal

Define Parameters

  • Call Function - Self Function Call triggered by a unique name. Instances are selected from the action it was called.

    • Function Name - Unique Function Name of this Object.


  • Add a Parameter - Add a Parameter for the next function. Can only be used with 'Call Self Function'.

    • Parameter Value - Parameter value for a parameter.



Input Parameters

  • Call Function with Params - Self Function Call triggered by a unique name with parameters. Instances are selected from the action it was called. Parameters are separated with '|'.

    • Function Name - Unique Function Name of this Object.

    • Parameters - Parameters are separated with '|'.


Universal

  • Set return value - In an 'On Self Function' event, set the return value.

    • Value - A number or some text to return from the function call.


  • Call expression - Call a function using a typed expression (via SelfFunction.Call()).

    • Expression - An expression to run, generally of the form Function.Call("func", ...).

Conditions

The following condition groups:

  • Universal

Universal

  • On Function - Self Function of the object which is identified by a unique name.

    • Function Name - Unique Function Name of this Object.


  • Compare Parameter - Self Function of the object which is identified by a unique name.

    • Parameter Index - The Parameter Index of the Self Function.

    • Compare By - The compare by method of the parameter value.

    • Parameter Value - The Parameter Value of the self Function.

Expressions

The following expression groups:

  • Universal

Universal

  • ParamCount - Return the number of params available.

  • Param - Syntax: 'Object.SelfFunction.Param(Index)'. This will return the value of the parameter. 0 if null.

    • 0 - ParamIndex.


  • ReturnValue - Get the value set by 'Set return value'. 0 if null.

  • Call - Get the value set by 'Set return value'.

    • Name - The name of the function to call.

Object   Properties

Plugin Properties


Properties
Showcase

Showcase

There is currently nothing to show, we will add more in the future.

Game Projects

Game Projects 

Instructions Kit

Specifications

  • Instructions - The game project contains instructions and steps on how to use the addon and its features.

  • Action, Conditions and Expressions - It covers the implementation of each action, condition and expression.

  • Tips and Tricks - It provides some tips and tricks on the recommended ways of using the addon.

Supporters

Only

bottom of page