Actor > Motion


Speed

Get Speed

get-speed-block

Returns the current [X / Y] speed for the actor.

[ACTOR].getXVelocity()
[ACTOR].getYVelocity()

Set Speed

set-speed-block

Sets the [X / Y] speed for the actor.

[ACTOR].setXVelocity([NUMBER]);
[ACTOR].setYVelocity([NUMBER]);

Set Velocity (given Direction and Speed)

set-velocity-block

Sets the actor's velocity, given a direction and a magnitude (speed) rather than X/Y components like above.

[ACTOR].setVelocity([NUMBER], [NUMBER]);

Force

Push (given X/Y)

push-xy-block

Pushes (or shoves) an actor, given an X/Y direction and force. Shoving is more "forceful" than pushing - experiment and see which works better for you.

[ACTOR].push([NUMBER], [NUMBER], [NUMBER]);
[ACTOR].shove([NUMBER], [NUMBER], [NUMBER]);

Push (given Angle)

push-angle-block

Pushes (or shoves) an actor, given an angle and force. Shoving is more "forceful" than pushing - experiment and see which works better for you.

[ACTOR].pushInDirection([NUMBER], [NUMBER]);
[ACTOR].shoveInDirection([NUMBER], [NUMBER]);

Twist (rotate using force)

twist-block

Twists (applies torque) to an actor, given a force.

[ACTOR].applyTorque(Utils.RAD * [NUMBER]);

Turning Speed

Get Turning Speed

get-avelocity-block

Returns the turning speed (angular velocity) of the actor (in degrees).

Utils.DEG * ([ACTOR].getAngularVelocity())

Set Turning Speed

set-avelocity-block

Sets the turning speed (angular velocity) of the actor (in degrees). Positive turns clockwise. Negative turns counter-clockwise.

[ACTOR].setAngularVelocity(Utils.RAD * [NUMBER]);

Physics

Toggle Gravity

gravity-block

Enables or disables gravity for this actor.

[ACTOR].setIgnoreGravity(false); //enable gravity
[ACTOR].setIgnoreGravity(true); //disable gravity

Toggle Rotation

toggle-rotation-block

Enables or disableds rotation for this actor.

[ACTOR].enableRotation();
[ACTOR].disableRotation();

Set Friction / Bounciness

set-friction-block

Sets the actor's friction and bounciness settings. Provide a value between [0.0 - 1.0] inclusive.

Read our Physics guide for an explanation of what these fields mean.

[ACTOR].setFriction([NUMBER]);
[ACTOR].setBounciness([NUMBER]);

Get Friction / Bounciness

get-friction-block

Gets the actor's friction and bounciness settings. Read our Physics guide for an explanation of what these fields mean.

[ACTOR].getFriction()
[ACTOR].getBounciness()