JavaScript simulate key input for behaviors

I have a PlatformerObject on my player and I want to use JavaScript to simulate a key press. Like this:

I have read the documentation on RuntimeBehaviors as well as RuntimeObjects and have come up empty handed.
Is there anything that I am missing?
Any incite would be greatly appreciated.

For the condition, you can search “pressed” in the documentation.
For the action, it’s based on an extension, so it’s not on that page, you need to go to the github and search for platformer and jump.
I see a “this._jumping = false;”, I guess it will jump if you set it to true.

I don’t know js, so all this is an educated guess at best. :sweat_smile:


I just needed to set the _jumpKey of the PlatformerObject behavior to true.

if(runtimeScene._runtimeGame.getInputManager().isKeyPressed(32))// Spacebar
    playerBehavior["_jumpKey"] = true;
1 Like