Physics Blocks

Basic Physics

{"func":"blockPhysicsStart"}

Start Physics

"Start Physics" enables the physics engine to run so that gravity, forces, collisions, etc can occur.

Parameters:

None.

Related Blocks:
{"func":"blockPhysicsSetGravity"} ,     {"func":"blockPhysicsStop"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockPhysicsStart","next":{"func":"blockPhysicsSetGravity","values":[{"type":"number","value":"0"},{"type":"number","value":"10"}],"next":{"func":"blockPhysicsApplyForceAngle","values":[{"type":"number","value":"10"},{"type":"number","value":"20"}],"next":{"func":"blockPhysicsStop"}}}}} Add to my Backpack


{"func":"blockPhysicsStop"}

Stop Physics

"Stop Physics" stops all physics-related events from occurring.

Parameters:

None.

Related Blocks:
{"func":"blockPhysicsSetGravity"} ,     {"func":"blockPhysicsStart"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockPhysicsStart","next":{"func":"blockPhysicsSetGravity","values":[{"type":"number","value":"0"},{"type":"number","value":"10"}],"next":{"func":"blockPhysicsApplyForceAngle","values":[{"type":"number","value":"10"},{"type":"number","value":"20"}],"next":{"func":"blockPhysicsStop"}}}}} Add to my Backpack


{"func":"blockPhysicsSetGravity"}

Set Gravity

"Set Gravity" sets the horizontal and vertical forces of gravity.

Parameters:

Horizontal Gravity: the horizontal gravity force will be set to this number.

Vertical Gravity: the vertical gravity force will be set to this number. Gravity has a vertical force of around 9.8 on earth!

Related Blocks:
{"func":"valuePhysicsXGravity"} ,     {"func":"valuePhysicsYGravity"} ,     {"func":"blockPhysicsStart"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockPhysicsStart","next":{"func":"blockPhysicsSetGravity","values":[{"type":"number","value":"0"},{"type":"number","value":"10"}],"next":{"func":"blockPhysicsApplyForceAngle","values":[{"type":"number","value":"10"},{"type":"number","value":"20"}],"next":{"func":"blockPhysicsStop"}}}}} Add to my Backpack


{"func":"blockPhysicsSetActorActive"}

Set Active

"Set Active" sets whether the Actor is affected by gravity and other Actors (when set to true, this Actor will be affected by physics).

Parameters:

Actor: this is the actor that is affected.

Bool: this parameter should be a boolean value (either true or false). If it"s true, this Actor will be set to active; if it"s false, this Actor will not be set to active.

Related Blocks:
{"func":"blockPhysicsSetActorStatic"} ,     {"func":"blockPhysicsSetGravity"}

Sample Code:
{"func":"registerCloned","next":{"func":"blockPhysicsSetActorActive","values":[{"type":"string","value":"ball"},{"type":"boolean","value":"true"}],"next":{"func":"blockLooksMoveBack","values":[{"type":"number","value":"1"}]}}} Add to my Backpack


{"func":"blockPhysicsSetActorStatic"}

Set Static

"Set Static" sets whether the Actor is affected by gravity and other Actors (when set to true, this Actor won’t be affected by physics).

Parameters:

Actor: this is the actor that is affected.

Bool: this parameter should be a boolean value (either true or false). If it"s true, this Actor will be set to static; if it"s false, this Actor will not be set to static.

Related Blocks:
{"func":"blockPhysicsSetActorActive"} ,     {"func":"blockPhysicsSetGravity"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockPhysicsStart","next":{"func":"blockPhysicsSetActorStatic","values":[{"type":"string","value":"ball"},{"type":"boolean","value":"true"}],"next":{"func":"blockPhysicsSetFriction","values":[{"type":"number","value":"0.5"}]}}}} Add to my Backpack


{"func":"blockPhysicsSetActorGeometry"}

Set Shape

"Set Shape" sets whether the Actor will be rectangular or circular when interacting with other Actors (e.g. collisions).

Parameters:

Actor: this is the actor that is affected.

Shape: this parameter will either be "rectangular," in which case the Actor is treated like a rectangle, or "circular," in which case the Actor is treated like a circle.

Related Blocks:
{"func":"registerSpriteCollision"} ,     {"func":"valuePhysicsCollidedWithSprite"}

Sample Code:
{"func":"blockPhysicsStart","next":{"func":"blockPhysicsSetActorGeometry","values":[{"type":"string","value":"ball"},{"type":"choice","value":"circular"}]}} Add to my Backpack


Collisions

{"func":"registerSpriteCollision"}

When Actor Collides

"When Actor Collides" is called when the Actor hits another Actor while using the physics engine.

Parameters:

None.

Related Blocks:
{"func":"valuePhysicsCollidedWithSprite"} ,     {"func":"valuePhysicsCollidedWithName"}

Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valuePhysicsCollidedWithSprite","values":[{"type":"string","value":"bottomedge"}]}],"containers":[{"func":"blockControlBroadcast","values":[{"type":"string","value":"GameOver"}]}]}} Add to my Backpack


{"func":"valuePhysicsCollidedWithSprite"}

Collided With?

"Collided With?" returns true if the Actor collided with the object specified by the parameter and false otherwise.

Parameters:

Actor: the method returns true if the current Actor collided with this parameter, which may be another Actor.

Related Blocks:
{"func":"registerSpriteCollision"} ,     {"func":"valuePhysicsCollidedWithName"}

Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valuePhysicsCollidedWithSprite","values":[{"type":"string","value":"bottomedge"}]}],"containers":[{"func":"blockControlBroadcast","values":[{"type":"string","value":"GameOver"}]}]}} Add to my Backpack


{"func":"valuePhysicsCollidedWithName"}

Collided With Actor Name

"Collided With Actor Name" returns the name of the Actor that the current Actor (whose code you are in) collided with. This block is typically used with the ‘When Actor Collides’ block.

Parameters:

None.

Related Blocks:
{"func":"registerSpriteCollision"} ,     {"func":"valuePhysicsCollidedWithSprite"}

Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valuePhysicsCollidedWithName"},{"type":"string","value":"Ball"}]}],"containers":[{"func":"blockPhysicsApplyImpulseAngle","values":[{"type":"number","value":"10"},{"type":"number","value":"10"}]}]}} Add to my Backpack


{"func":"valuePhysicsTouchingActor"}

Touching Actor?

"Touching Actor?" returns true if the Actor touched the object specified by the parameter and false otherwise.

Parameters:

Actor: the method returns true if the current Actor touched this parameter, which may be another Actor.

Related Blocks:
{"func":"registerSpriteCollision"}

Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valuePhysicsTouchingActor","values":[{"type":"string","value":"ghost"}]}],"containers":[{"func":"blockControlBroadcast","values":[{"type":"string","value":"GameOver"}]}]}} Add to my Backpack


Physical Properties

{"func":"blockPhysicsSetDensity"}

Set Density

"Set Density" sets the density of the Actor, which affects how heavy it appears.

Parameters:

Density: this parameter is the number that the density will be set to. A higher number means the Actor will appear heavier.

Related Blocks:
{"func":"valuePhysicsDensity"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockPhysicsStart","next":{"func":"blockPhysicsSetActive","values":[{"type":"boolean","value":"true"}],"next":{"func":"blockPhysicsSetRestitution","values":[{"type":"number","value":"0.2"}],"next":{"func":"blockPhysicsSetDensity","values":[{"type":"number","value":"10"}]}}}}} Add to my Backpack


{"func":"blockPhysicsSetFriction"}

Set Friction

"Set Friction" sets the friction of the Actor, which affects how difficult it is for the Actor to glide on surfaces.

Parameters:

Friction: this parameter is the number that the friction will be set to. A higher number means the Actor will have more trouble sliding.

Related Blocks:
{"func":"blockPhysicsSetLinearVelocity"} ,     {"func":"valuePhysicsFriction"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockPhysicsStart","next":{"func":"blockPhysicsSetStatic","values":[{"type":"boolean","value":"true"}],"next":{"func":"blockPhysicsSetFriction","values":[{"type":"number","value":"0.5"}]}}}} Add to my Backpack


{"func":"blockPhysicsSetRestitution"}

Set Restitution

"Set Restitution" sets the restitution of the Actor, which affects how bouncy it is.

Parameters:

Restitution: this parameter is the number that the restitution will be set to. A higher number means the Actor will appear bouncier.

Related Blocks:
{"func":"valuePhysicsRestitution"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockPhysicsStart","next":{"func":"blockPhysicsSetActive","values":[{"type":"boolean","value":"true"}],"next":{"func":"blockPhysicsSetRestitution","values":[{"type":"number","value":"0.2"}],"next":{"func":"blockPhysicsSetDensity","values":[{"type":"number","value":"10"}]}}}}} Add to my Backpack


{"func":"valuePhysicsDensity"}

Density

"Density" returns the Actor’s density.

Parameters:

None.

Related Blocks:
{"func":"blockPhysicsSetDensity"}

Sample Code:
{"func":"blockLooksSay","values":[{"type":"string","value":"Density affects how heavy an object looks. Right now your density is:"},{"type":"wrapper","func":"valuePhysicsDensity"}]} Add to my Backpack


{"func":"valuePhysicsFriction"}

Friction

"Friction" returns the Actor’s friction.

Parameters:

None.

Related Blocks:
{"func":"blockPhysicsSetFriction"}

Sample Code:
{"func":"blockLooksSay","values":[{"type":"string","value":"Friction makes it harder for objects to slide. Right now your friction is:"},{"type":"wrapper","func":"valuePhysicsFriction"}]} Add to my Backpack


{"func":"valuePhysicsRestitution"}

Restitution

"Restitution" returns the Actor’s restitution.

Parameters:

None.

Related Blocks:
{"func":"blockPhysicsSetRestitution"}

Sample Code:
{"func":"blockLooksSay","values":[{"type":"string","value":"Restitution affects bounciness. Right now your restitution is:"},{"type":"wrapper","func":"valuePhysicsRestitution"}]} Add to my Backpack


Force

{"func":"blockPhysicsApplyForce"}

Apply Force

"Apply Force" applies a force of magnitude specified by the parameter to the current Actor.

Parameters:

Magnitude: this number indicates the magnitude, or strength, of the force.

Related Blocks:
{"func":"blockPhysicsApplyImpulse"} ,     {"func":"blockPhysicsApplyForceAngle"} ,     {"func":"blockPhysicsApplyImpulseAngle"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockPhysicsStart","next":{"func":"blockPhysicsApplyForce","values":[{"type":"number","value":"10"}]}}} Add to my Backpack


{"func":"blockPhysicsApplyImpulse"}

Apply Impulse

"Apply Impulse" applies an impulse of magnitude specified by the parameter to the current Actor.

Parameters:

Magnitude: this number indicates the magnitude, or strength, of the impulse.

Related Blocks:
{"func":"blockPhysicsApplyForce"} ,     {"func":"blockPhysicsApplyForceAngle"} ,     {"func":"blockPhysicsApplyImpulseAngle"}

Sample Code:
{"func":"blockPhysicsStart","next":{"func":"blockPhysicsApplyImpulse","values":[{"type":"number","value":"100"}]}} Add to my Backpack


{"func":"blockPhysicsApplyTorque"}

Apply Torque

"Apply Torque" applies a rotational force (like a twist) of the specified magnitude to the Actor.

Parameters:

Magnitude: this number indicates the magnitude, or strength, of the force.

Related Blocks:
{"func":"blockPhysicsApplyForce"} ,     {"func":"blockPhysicsApplyImpulse"} ,     {"func":"blockPhysicsApplyForceAngle"}

Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockPhysicsApplyTorque","values":[{"type":"number","value":"10"}]}} Add to my Backpack


{"func":"blockPhysicsApplyForceAngle"}

Apply Force At

"Apply Force At" applies a force of the specified magnitude and angle to the current Actor.

Parameters:

Magnitude: this number indicates the magnitude, or strength, of the force.

Direction: this parameter is the angle (in degrees) that the force will apply at. (0 degrees is towards the top of the screen, 90 degrees is towards the right.)

Related Blocks:
{"func":"blockPhysicsApplyForce"} ,     {"func":"blockPhysicsApplyImpulse"} ,     {"func":"blockPhysicsApplyImpulseAngle"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockPhysicsStart","next":{"func":"blockPhysicsSetGravity","values":[{"type":"number","value":"0"},{"type":"number","value":"10"}],"next":{"func":"blockPhysicsApplyForceAngle","values":[{"type":"number","value":"10"},{"type":"number","value":"20"}],"next":{"func":"blockPhysicsStop"}}}}} Add to my Backpack


{"func":"blockPhysicsApplyImpulseAngle"}

Apply Impulse At

"Apply Impulse At" applies an impulse of the specified magnitude and angle to the current Actor.

Parameters:

Magnitude: this number indicates the magnitude, or strength, of the impulse.

Direction: this parameter is the angle (in degrees) that the impulse will apply at. (0 degrees is towards the top of the screen, 90 degrees is towards the right.)

Related Blocks:
{"func":"blockPhysicsApplyForce"} ,     {"func":"blockPhysicsApplyImpulse"} ,     {"func":"blockPhysicsApplyForceAngle"}

Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valuePhysicsCollidedWithName"},{"type":"string","value":"Ball"}]}],"containers":[{"func":"blockPhysicsApplyImpulseAngle","values":[{"type":"number","value":"10"},{"type":"number","value":"10"}]}]}} Add to my Backpack


{"func":"blockPhysicsApplyForceXY"}

Apply Horizontal and Vertical Force

"Apply Horizontal And Vertical Force" applies a force defined by the specified X vector and Y vector on the current Actor.

Parameters:

Horizontal Force: this number is the magnitude of the force only in the X direction.

Vertical Force: this number is the magnitude of the force only in the Y direction.

Related Blocks:
{"func":"blockPhysicsApplyForce"} ,     {"func":"blockPhysicsApplyImpulse"} ,     {"func":"blockPhysicsApplyForceAngle"}

Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valuePhysicsCollidedWithName"},{"type":"string","value":"Ball"}]}],"containers":[{"func":"blockPhysicsApplyImpulse","values":[{"type":"number","value":"30"}]}]}} Add to my Backpack


{"func":"blockPhysicsApplyImpulseXY"}

Apply Horizontal and Vertical Impulse

"Apply Horizontal And Vertical Impulse" applies an impulse defined by the specified X vector and Y vector on the current Actor.

Parameters:

Horizontal Force: this number is the magnitude of the impulse only in the X direction.

Vertical Force: this number is the magnitude of the impulse only in the Y direction.

Related Blocks:
{"func":"blockPhysicsApplyForce"} ,     {"func":"blockPhysicsApplyImpulse"} ,     {"func":"blockPhysicsApplyForceAngle"}

Sample Code:
{"func":"registerSpriteTrigger","next":{"func":"blockPhysicsApplyImpulseXY","values":[{"type":"number","value":"0"},{"type":"number","value":"0"}]}} Add to my Backpack


{"func":"blockPhysicsSetAngularDamping"}

Set Angular Damping

"Set Angular Damping" sets the angular damping of the Actor, which affects the amplitude of its oscillations.

Parameters:

Angular Damping: this parameter is the number that the angular damping will be set to.

Related Blocks:
{"func":"blockPhysicsSetLinearDamping"} ,     {"func":"valuePhysicsAngularDamping"}

Sample Code:
{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valuePhysicsAngularDamping"},{"type":"string","value":"1"}]}],"containers":[{"func":"blockPhysicsSetAngularDamping","values":[{"type":"number","value":"5"}]}]} Add to my Backpack


{"func":"blockPhysicsSetLinearDamping"}

Set Linear Damping

"Set Linear Damping" sets the linear damping of the Actor, which affects how rigid it is.

Parameters:

Linear Damping: this parameter is the number that the linear damping will be set to. A higher number makes the Actor more rigid.

Related Blocks:
{"func":"blockPhysicsSetLinearDamping"} ,     {"func":"valuePhysicsLinearDamping"}

Sample Code:
{"func":"blockPhysicsStart","next":{"func":"blockPhysicsSetLinearDamping","values":[{"type":"wrapper","func":"valueOpAdd","values":[{"type":"wrapper","func":"valuePhysicsLinearDamping"},{"type":"number","value":"10"}]}]}} Add to my Backpack


{"func":"valuePhysicsXGravity"}

X Gravity

"X Gravity" returns the X component of gravity.

Parameters:

None.

Related Blocks:
{"func":"blockPhysicsSetGravity"} ,     {"func":"valuePhysicsYGravity"} ,     {"func":"blockPhysicsStart"}

Sample Code:
{"func":"blockLooksSay","values":[{"type":"string","value":"Current X-component of gravity:"},{"type":"wrapper","func":"valuePhysicsXGravity"}],"next":{"func":"blockLooksSay","values":[{"type":"string","value":"Current Y-component of gravity:"},{"type":"wrapper","func":"valuePhysicsYGravity"}]}} Add to my Backpack


{"func":"valuePhysicsYGravity"}

Y Gravity

"Y Gravity" returns the Y component of gravity.

Parameters:

None.

Related Blocks:
{"func":"blockPhysicsSetGravity"} ,     {"func":"valuePhysicsXGravity"} ,     {"func":"blockPhysicsStart"}

Sample Code:
{"func":"blockLooksSay","values":[{"type":"string","value":"Current X-component of gravity:"},{"type":"wrapper","func":"valuePhysicsXGravity"}],"next":{"func":"blockLooksSay","values":[{"type":"string","value":"Current Y-component of gravity:"},{"type":"wrapper","func":"valuePhysicsYGravity"}]}} Add to my Backpack


{"func":"valuePhysicsAngularDamping"}

Angular Damping

"Angular Damping" returns the Actor’s angular damping.

Parameters:

None.

Related Blocks:
{"func":"blockPhysicsSetAngularDamping"}

Sample Code:
{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valuePhysicsAngularDamping"},{"type":"string","value":"1"}]}],"containers":[{"func":"blockPhysicsSetAngularDamping","values":[{"type":"number","value":"5"}]}]} Add to my Backpack


{"func":"valuePhysicsLinearDamping"}

Linear Damping

"Linear Damping" returns the Actor’s linear damping.

Parameters:

None.

Related Blocks:
{"func":"blockPhysicsSetLinearDamping"}

Sample Code:
{"func":"blockPhysicsStart","next":{"func":"blockPhysicsSetLinearDamping","values":[{"type":"wrapper","func":"valueOpAdd","values":[{"type":"wrapper","func":"valuePhysicsLinearDamping"},{"type":"number","value":"10"}]}]}} Add to my Backpack


{"func":"valuePhysicsInertia"}

Inertia

"Inertia" returns the Actor’s inertia (its resistance to change its state of motion).

Parameters:

None.

Related Blocks:
{"func":"valuePhysicsFriction"} ,     {"func":"valuePhysicsRestitution"} ,     {"func":"valuePhysicsDensity"}

Sample Code:
{"func":"blockLooksSay","values":[{"type":"string","value":"Inertia affects how resistant an object is to motion. Right now your inertia is:"},{"type":"wrapper","func":"valuePhysicsInertia"}]} Add to my Backpack


Velocity

{"func":"blockPhysicsSetLinearVelocity"}

Set Linear Velocity

"Set Linear Velocity" sets the linear velocity of the Actor, which affects the Actor’s speed.

Parameters:

Linear Velocity: this parameter is the number that the linear velocity will be set to. A higher linear velocity means the Actor will move faster.

Related Blocks:
{"func":"blockPhysicsSetLinearVelocity"} ,     {"func":"valuePhysicsXVelocity"} ,     {"func":"valuePhysicsYVelocity"}

Sample Code:
{"func":"blockPhysicsStart","next":{"func":"blockPhysicsSetLinearVelocity","values":[{"type":"number","value":"10"},{"type":"number","value":"0"}]}} Add to my Backpack


{"func":"blockPhysicsSetLinearVelocityXY"}

Set Linear Velocity XY

"Set Linear Velocity" sets the linear velocity of the Actor, which affects the Actor’s speed.

Parameters:

Linear Velocity X: this parameter is the x-component that the linear velocity will be set to. A higher linear velocity means the Actor will move faster.

Linear Velocity Y: this parameter is the y-component that the linear velocity will be set to. A higher linear velocity means the Actor will move faster.

Related Blocks:
{"func":"blockPhysicsSetLinearVelocity"} ,     {"func":"valuePhysicsXVelocity"} ,     {"func":"valuePhysicsYVelocity"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockPhysicsSetLinearVelocityXY","values":[{"type":"number","value":10},{"type":"number","value":2}]}} Add to my Backpack


{"func":"blockPhysicsSetAngularVelocity"}

Set Angular Velocity

"Set Angular Velocity" sets the angular velocity of the Actor, which affects how fast the Actor rotates.

Parameters:

Angular Velocity: this parameter is the number that the angular velocity will be set to. A higher angular velocity means the Actor will spin faster.

Related Blocks:
{"func":"blockPhysicsSetLinearVelocity"} ,     {"func":"valuePhysicsAngularVelocity"}

Sample Code:
{"func":"blockPhysicsSetAngularVelocity","values":[{"type":"wrapper","func":"valueSensingSpriteProperty","values":[{"type":"choice","value":"angularvelocity"},{"type":"string","value":"Ball"}]}]} Add to my Backpack


{"func":"valuePhysicsAngularVelocity"}

Angular Velocity

"Angular Velocity" returns the Actor’s angular velocity.

Parameters:

None.

Related Blocks:
{"func":"blockPhysicsSetAngularVelocity"}

Sample Code:
{"func":"blockSensingAskAndWait","values":[{"type":"string","value":"How fast do you want to go? Right now your angular velocity is:"},{"type":"wrapper","func":"valuePhysicsAngularVelocity"}],"next":{"func":"blockPhysicsSetAngularVelocity","values":[{"type":"wrapper","func":"valueSensingAnswer"}]}} Add to my Backpack


{"func":"valuePhysicsXVelocity"}

X Linear Velocity

"X Linear Velocity" returns the Actor’s X component of velocity, or how fast it is moving in the positive X direction.

Parameters:

None.

Related Blocks:
{"func":"blockPhysicsSetLinearVelocity"} ,     {"func":"valuePhysicsYVelocity"}

Sample Code:
{"func":"blockPhysicsSetLinearVelocity","values":[{"type":"wrapper","func":"valueOpRandom","values":[{"type":"number","value":"0"},{"type":"wrapper","func":"valuePhysicsXVelocity"}]},{"type":"wrapper","func":"valueOpRandom","values":[{"type":"number","value":"0"},{"type":"wrapper","func":"valuePhysicsYVelocity"}]}]} Add to my Backpack


{"func":"valuePhysicsYVelocity"}

Y Linear Velocity

"Y Linear Velocity" returns the Actor’s Y component of velocity, or how fast it is moving in the positive Y direction.

Parameters:

None.

Related Blocks:
{"func":"blockPhysicsSetLinearVelocity"} ,     {"func":"valuePhysicsXVelocity"}

Sample Code:
{"func":"blockPhysicsSetLinearVelocity","values":[{"type":"wrapper","func":"valueOpRandom","values":[{"type":"number","value":"0"},{"type":"wrapper","func":"valuePhysicsXVelocity"}]},{"type":"wrapper","func":"valueOpRandom","values":[{"type":"number","value":"0"},{"type":"wrapper","func":"valuePhysicsYVelocity"}]}]} Add to my Backpack


{"func":"valuePhysicsIsAwake"}

Is Awake?

"Is Awake?" returns true if the Actor is still moving and false otherwise.

Parameters:

None.

Related Blocks:
{"func":"valueLooksIsHidden"}

Sample Code:
{"func":"blockControlIf","values":[{"type":"wrapper","func":"valuePhysicsIsAwake"}],"containers":[{"func":"blockLooksHide"}]} Add to my Backpack


Advanced

{"func":"valuePhysicsGetProperty"}

Get Property

"Get Property" returns the specified physics property of the specified Actor.

Parameters:

Property: this variable is the property you want to access.

Actor: this variable is the name of the Actor whose property you want to access.

Sample Code:
{"func":"blockLooksSay","values":[{"type":"string","value":"Density affects how heavy an object looks. Right now your density is:"},{"type":"wrapper","func":"valuePhysicsGetProperty","values":[{"type":"choice","value":"density"},{"type":"string","value":"self"}]}]} Add to my Backpack


{"func":"blockPhysicsApply"}

Apply

"Apply" applies the chosen physics property on the specified Actor with the given magnitude.

Parameters:

Property: can be force, torque, impulse, density, friction, restitution, angular damping, angular velocity, linear damping, linear velocity.

Actor: this is set to the actor that is affected.

Magnitude: this number indicates the magnitude, or strength, of the force.

Related Blocks:
{"func":"blockPhysicsApplyXY"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockPhysicsStart","next":{"func":"blockPhysicsApply","values":[{"type":"choice","value":"force"},{"type":"string","value":"self"},{"type":"number","value":"10"}]}}} Add to my Backpack


{"func":"blockPhysicsApplyXY"}

Apply XY

"Apply XY" applies the chosen physics property on the specified Actor with the given X and Y components.

Parameters:

Property: can be force, torque, impulse, density, friction, restitution, angular damping, angular velocity, linear damping, linear velocity.

Actor: this is set to the actor that is affected.

X: this parameter is the x-component that the physics property will be set to.

Y: this parameter is the y-component that the physics property will be set to.

Related Blocks:
{"func":"blockPhysicsApply"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockPhysicsStart","next":{"func":"blockPhysicsApply","values":[{"type":"choice","value":"force"},{"type":"string","value":"self"},{"type":"number","value":"10"}]}}} Add to my Backpack