Class: RuntimeBehavior

RuntimeBehavior

new gdjs.RuntimeBehavior(runtimeScene, behaviorData, owner)

RuntimeBehavior represents a behavior being used by a RuntimeObject.

Name Type Description
runtimeScene gdjs.RuntimeScene

The scene owning the object of the behavior

behaviorData BehaviorData

The properties used to setup the behavior

owner gdjs.RuntimeObject

The object owning the behavior

Methods

activate(enable)

De/Activate the behavior

Name Type Description
enable boolean

true to enable the behavior, false to disable it

Return true if the behavior is activated

doStepPostEvents(runtimeScene)

This method is called each tick after events are done.

Name Type Description
runtimeScene gdjs.RuntimeScene

The runtimeScene owning the object

doStepPreEvents(runtimeScene)

This method is called each tick before events are done.

Name Type Description
runtimeScene gdjs.RuntimeScene

The runtimeScene owning the object

getName(){string}

Get the name of the behavior.

Returns:
Type Description
string The behavior's name.

getNameId(){number}

Get the name identifier of the behavior.

Returns:
Type Description
number The behavior's name identifier.

Reimplement this method to do extra work when the behavior is activated (after it has been deactivated, see onDeActivate).

Reimplement this to do extra work when the behavior is created (i.e: an object using it was created), after the object is fully initialized (so you can use this.owner without risk).

onDeActivate()

Reimplement this method to do extra work when the behavior is deactivated.

This method is called when the owner of the behavior is being removed from the scene and is about to be destroyed/reused later,

stepPostEvents(runtimeScene)

Called at each frame after events. Call doStepPostEvents.
Behaviors writers: Please do not redefine this method. Redefine doStepPreEvents instead.

Name Type Description
runtimeScene gdjs.RuntimeScene

The runtimeScene owning the object

stepPreEvents(runtimeScene)

Called at each frame before events. Call doStepPreEvents.
Behaviors writers: Please do not redefine this method. Redefine doStepPreEvents instead.

Name Type Description
runtimeScene gdjs.RuntimeScene

The runtimeScene owning the object