Moving a character a given distance

How do I…

I’m trying to create a behavior function that moves a character down a given distance when space is pressed once.

What is the expected result

Space is pressed, the character move downward and the action doesn’t stop until he reaches for instance ten meters below his original position.

What is the actual result

The game freezes when I click space.

Related screenshots


The behavior property translated to current speed. If the current speed is zero then 0 times anything will give you a force of zero and the object will never move and the while loop will never end.

It might be easier to use a tween. You can use tweens in behaviors by adding them as a parameter. A required parameter for the behavior and a parameter for any function that uses it.