De/Activate the behavior
true to enable the behavior, false to disable it
Return true if the behavior is activated
Check if the Character can jump.
Returns true if the object can jump.
Called before the physics engine step.
This method is called each tick after events are done.
This method is called each tick before events are done.
Get the speed at which the object is falling. It is 0 when the object is on a floor, and non 0 as soon as the object leaves the floor.
The current fall speed.
Get the current speed of the Character.
The current speed.
Get the current jump speed of the Character.
The current jump speed.
Get the current speed of the Character.
The current speed.
Get the forward acceleration value of the Character.
The current acceleration.
Get the forward deceleration of the Character.
The current deceleration.
Get the forward maximum speed of the Character.
The maximum speed.
Get the gravity of the Character.
The current gravity.
Get the jump speed of the Character.
The jump speed.
Get the jump sustain time of the Character.
The jump sustain time.
Get the maximum falling speed of the Character.
The maximum falling speed.
Get the name of the behavior.
The behavior's name.
Get the name identifier of the behavior.
The behavior's name identifier.
Get the sideways acceleration value of the Character.
The current acceleration.
Get the sideways deceleration of the Character.
The current deceleration.
Get the sideways maximum speed of the Character.
The maximum speed.
Get maximum angle of a slope for the Character to run on it as a floor.
the slope maximum angle, in degrees.
Check if the Character is "going down", either because it's in the falling state or because it's jumping but reached the jump peak and is now going down (because the jump speed can't compensate anymore the falling speed).
If you want to check if the object is falling outside of a jump (or because
the jump is entirely finished and there is no jump speed applied to the object
anymore), consider using isFallingWithoutJumping
.
Returns true if it is "going down" and false if not.
Check if the Character is in the falling state. This is false if the object is jumping, even if the object is going down after reaching the jump peak.
Returns true if it is falling and false if not.
Check if the Character is jumping.
Returns true if jumping and false if not.
Check if the Character is moving.
Returns true if it is moving and false if not.
Check if the Character is on a floor.
Returns true if on a floor and false if not.
Check if the Character is on the given object.
Returns true if on the object and false if not.
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).
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
or when the behavior is removed from an object (can happen in case of
hot-reloading only. Otherwise, behaviors are just de-activated,
not removed. See onDeActivate
).
This method is called when the owner of the behavior was hot reloaded, so its position, angle, size can have been changed outside of events.
Allow the Character to jump again.
Forbid the Character to air jump.
Set the current fall speed.
Set the current speed of the Character.
The current speed.
Set the current jump speed.
Set the current speed of the Character.
The current speed.
Set the forward acceleration of the Character.
The new acceleration.
Set the forward deceleration of the Character.
The new deceleration.
Set the forward maximum speed of the Character.
The new maximum speed.
Set the gravity of the Character.
The new gravity.
Set the jump speed of the Character.
The new jump speed.
Set the jump sustain time of the Character.
Set the maximum falling speed of the Character.
The maximum falling speed.
If true and if jumping, tune the current jump speed to preserve the overall speed in the air.
Set the sideways acceleration of the Character.
The new acceleration.
Set the sideways deceleration of the Character.
The new deceleration.
Set the sideways maximum speed of the Character.
The new maximum speed.
Set the maximum slope angle of the Character.
The new maximum slope angle.
Called at each frame after events. Call doStepPostEvents.
Behaviors writers: Please do not redefine this method. Redefine doStepPreEvents instead.
The instanceContainer owning the object
Called at each frame before events. Call doStepPreEvents.
Behaviors writers: Please do not redefine this method. Redefine doStepPreEvents instead.
The instanceContainer owning the object
Called when the behavior must be updated using the specified behaviorData. This is the case during hot-reload, and is only called if the behavior was modified.
true if the behavior was updated, false if it could not (i.e: hot-reload is not supported).
Update the behavior properties using the provided data.
Should return false
if the behavior does not need any lifecycle function to
be called.
Default, hidden, "capability" behaviors set it to false
.
This avoids useless calls to empty lifecycle functions, which would waste CPU
time (and have a sizeable impact for example when lots of static instances
are living in the scene).
A very small value compare to 1 pixel, yet very huge compare to rounding errors.
Generated using TypeDoc
Abort the current jump.
When the character is not in the jumping state this method has no effect.