Platformercontrolswrapper

PlatformerControlsWrapper class

This class implements traditional platformer controls, with support for jumping, running, etc

the controls use keyboard keys W, A, S, D or Arrow keys for movement, and SPACE for jumping;

The meaning of object & target options is intepreted as follows:

  • The object is moved by the controls actions

  • The target is used to determine the forward direction of the movement

The behavior of the controls can be customized using the params object. See PlatformerControlsWrapperParams for more info

Signature:

export declare class PlatformerControlsWrapper extends ControlsAbstract 

Extends: ControlsAbstract

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the PlatformerControlsWrapper class.

Properties

PropertyModifiersTypeDescription
actionsPCActions

The actions influence the movement of the attached object. Those are typically set automtically from the user input.

If you deactivate the controls's controller, you can set those manually to control the movement of the attached object

activebooleanwhether the controls are active
autoRotatebooleanWhen true, the controls will automatically set the forward direction of the movement based on the target object's rotation. Default is true.
collidesWithCollisionInfo[]a list of objects that the attached object is colliding with in the current frame
controllerControllerThe controller handles the input events and sets the corresponding actions
isJumpingbooleanIndicates whether the attached object is currently jumping
isMovingbooleanIndicates whether the attached object is currently moving (walking, jumping, etc)
onFloorbooleanIndicates whether the attached object is colliding with a ground collider (like a terrain)

Methods

MethodModifiersDescription
dispose()