Behaviors in javascript code

How can I manipulate the behavior properties in the javascript code event?

For example I already got the behavior I want (“TopDownMovement”) and I checked the key presses, now how do i simulate the keystroke of this behavior?

const player = runtimeScene.getObjects('Player')[0];
const light = runtimeScene.getObjects('Light')[0];
const behaivor = player.getBehavior('TopDownMovement');
const keyboard = runtimeScene.getGame().getInputManager();



if (keyboard.isKeyPressed(65)) {
} else if (keyboard.isKeyPressed(68)) {

if (keyboard.isKeyPressed(87)) {

} else if (keyboard.isKeyPressed(83)) {


On topdownmovement behavior, you can do:

  • ignoreDefaultControls(true)
  • simulateLeftKey
  • simulateRightKey
  • simulateUpKey
  • simulateDownKey
  • simulateControl(“Left”) //Left, Right, Up, Down

The js doc is not written yet, you can see the method here..

1 Like

Oh I’m sorry, I was putting the name of the method as simulateLeftKeyPress, so the correct name doesn’t have the “Press”

Thank you!