Motion Blocks

Movement

{"func":"blockMotionMove"}

Move

"Move" moves an Actor by the specified number of pixels.

Parameters:

Number of Pixels: this parameter indicates how many pixels the Actor will move.

Related Blocks:
{"func":"blockMotionGoTo"} ,     {"func":"blockMotionGlide"} ,     {"func":"blockMotionSetX"} ,     {"func":"blockMotionSetY"}

Sample Code:
{"func":"registerKeyTrigger","values":[{"type":"choice","value":"right arrow"}],"next":{"func":"blockMotionPointTowards","values":[{"type":"string","value":"right edge"}],"next":{"func":"blockMotionMove","values":[{"type":"number","value":"5"}]}}} Add to my Backpack


{"func":"blockMotionGoTo"}

Go To

"Go To" moves an Actor to the given X and Y coordinates on the Stage.

Parameters:

X: this parameter indicates the X coordinate on the Stage that the Actor should move to.

Y: this parameter indicates the Y coordinate on the Stage that the Actor should move to.

Related Blocks:
{"func":"blockMotionGoTowards"} ,     {"func":"blockMotionMove"}

Sample Code:
{"func":"blockMotionGoTo","values":[{"type":"number","value":"10"},{"type":"number","value":"10"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":"5"}],"next":{"func":"blockLooksNextCostume"}}} Add to my Backpack


{"func":"blockMotionGoTowards"}

Go To Actor

"Go To Actor" sets the position of an Actor to the position of the parameter.

Parameters:

Actor: your Actor will move to the the position of this Actor.

Related Blocks:
{"func":"blockMotionGoTo"} ,     {"func":"blockMotionMove"}

Sample Code:
{"func":"blockControlForever","containers":[{"func":"blockMotionGoTowards","values":[{"type":"string","value":"mouse-pointer"}]}]} Add to my Backpack


{"func":"blockMotionGlide"}

Glide

"Glide" points and moves an Actor towards the specified X and Y coordinates over the duration of time specified by the first parameter.

Parameters:

Seconds: this parameter is the number of seconds that the glide will last.

X: this parameter is the destination X coordinate.

Y: this parameter is the destination Y coordinate.

Related Blocks:
{"func":"blockMotionGoTo"} ,     {"func":"blockMotionMove"} ,     {"func":"blockMotionGoTowards"}

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


{"func":"blockMotionBounceOnEdge"}

If On Edge, Bounce

"If On Edge, Bounce" tells an Actor to bounce if it reaches the end of the screen.

Parameters:

None.

Related Blocks:
{"func":"blockControlIf"} ,     {"func":"blockControlIfElse"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockMotionRotationStyle","values":[{"type":"choice","value":"left-right"}],"next":{"func":"blockControlForever","containers":[{"func":"blockMotionMove","values":[{"type":"number","value":"10"}],"next":{"func":"blockMotionBounceOnEdge","next":{"func":"blockControlWait","values":[{"type":"number","value":".1"}]}}}]}}} Add to my Backpack


Position

{"func":"blockMotionSetX"}

Set X To

"Set X To" sets an Actor’s X coordinate to the parameter.

Parameters:

X: your Actor"s new X coordinate will be this value.

Related Blocks:
{"func":"blockMotionChangeXBy"} ,     {"func":"blockMotionChangeYBy"} ,     {"func":"blockMotionSetY"}

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


{"func":"blockMotionSetY"}

Set Y To

"Set Y To" sets an Actor’s Y coordinate to the parameter.

Parameters:

Y: your Actor"s new Y coordinate will be this value.

Related Blocks:
{"func":"blockMotionChangeXBy"} ,     {"func":"blockMotionChangeYBy"} ,     {"func":"blockMotionSetX"}

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


{"func":"valueMotionXPosition"}

X Position

"X Position" returns the Actor’s X coordinate.

Parameters:

None.

Related Blocks:
{"func":"valueMotionYPosition"} ,     {"func":"blockMotionGoTo"}

Sample Code:
{"func":"blockPenDrawText","values":[{"type":"wrapper","func":"valueOpJoin","values":[{"type":"string","value":"X:"},{"type":"wrapper","func":"valueMotionXPosition"},{"type":"string","value":"Y:"},{"type":"wrapper","func":"valueMotionYPosition"},{"type":"string","value":"Direction:"},{"type":"wrapper","func":"valueMotionDirection"}]}]} Add to my Backpack


{"func":"valueMotionYPosition"}

Y Position

"Y Position" returns the Actor’s Y coordinate.

Parameters:

None.

Related Blocks:
{"func":"valueMotionXPosition"} ,     {"func":"blockMotionGoTo"}

Sample Code:
{"func":"blockPenDrawText","values":[{"type":"wrapper","func":"valueOpJoin","values":[{"type":"string","value":"X:"},{"type":"wrapper","func":"valueMotionXPosition"},{"type":"string","value":"Y:"},{"type":"wrapper","func":"valueMotionYPosition"},{"type":"string","value":"Direction:"},{"type":"wrapper","func":"valueMotionDirection"}]}]} Add to my Backpack


{"func":"blockMotionChangeXBy"}

Change X By

"Change X By" increments the X coordinate of an Actor by the specified number of pixels.

Parameters:

Units: your Actor"s new X coordinate will be its current X coordinate plus this value. You can use a negative value if you want to move left.

Related Blocks:
{"func":"blockMotionSetX"} ,     {"func":"blockMotionChangeYBy"} ,     {"func":"blockMotionSetY"}

Sample Code:
{"func":"blockControlRepeat","values":[{"type":"number","value":"10"}],"containers":[{"func":"blockMotionChangeXBy","values":[{"type":"number","value":"10"}],"next":{"func":"blockMotionChangeYBy","values":[{"type":"number","value":"20"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":"1"}]}}}]} Add to my Backpack


{"func":"blockMotionChangeYBy"}

Change Y By

"Change Y By" increments the Y coordinate of an Actor by the specified number of pixels.

Parameters:

Units: your Actor"s new Y coordinate will be its current Y coordinate plus this value. You can use a negative value if you want to move left.

Related Blocks:
{"func":"blockMotionChangeXBy"} ,     {"func":"blockMotionSetX"} ,     {"func":"blockMotionSetY"}

Sample Code:
{"func":"blockControlRepeat","values":[{"type":"number","value":"10"}],"containers":[{"func":"blockMotionChangeXBy","values":[{"type":"number","value":"10"}],"next":{"func":"blockMotionChangeYBy","values":[{"type":"number","value":"20"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":"1"}]}}}]} Add to my Backpack


Rotation

{"func":"blockMotionTurnCCW"}

Turn Counter-Clockwise

"Turn Counter-Clockwise" rotates an Actor the specified number of degrees in the counter-clockwise direction.

Parameters:

Degrees: this parameter indicates the number of degrees the Actor should turn, in the counter-clockwise direction.

Related Blocks:
{"func":"blockMotionTurnCW"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockControlRepeat","values":[{"type":"number","value":"10"}],"containers":[{"func":"blockMotionTurnCCW","values":[{"type":"string","value":"15"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":".5"}]}}]}} Add to my Backpack


{"func":"blockMotionPointDirection"}

Point in Direction

"Point in Direction" points an Actor in the direction specified by the parameter.

Parameters:

Degrees: this parameter indicates the direction, in degrees, that the Actor should face. 90 degrees is to the right, 0 is upwards, and so on.

Related Blocks:
{"func":"blockMotionPointTowards"}

Sample Code:
{"func":"blockInlineComment","values":[{"type":"string","value":"Point left"}],"next":{"func":"blockMotionPointDirection","values":[{"type":"string","value":-90}]}} Add to my Backpack


{"func":"blockMotionPointAngle"}

Set Angle

"Set Angle" points an Actor in the direction specified by the parameter.

Parameters:

Degrees: this parameter indicates the angle, in degrees, that the Actor should face. 0 degrees is to the right, 90 is upwards, and so on.

Related Blocks:
{"func":"blockMotionPointDirection"} ,     {"func":"blockMotionPointTowards"}

Sample Code:
{"func":"blockInlineComment","values":[{"type":"string","value":"Point left"}],"next":{"func":"blockMotionPointAngle","values":[{"type":"string","value":180}]}} Add to my Backpack


{"func":"blockMotionPointTowards"}

Point Towards

"Point Towards" points an Actor towards the parameter (e.g. mouse-pointer or another Actor).

Parameters:

Space: this parameter indicates where the Actor should point towards. Some options are "mouse-pointer," "left edge," and "top edge."

Related Blocks:
{"func":"blockMotionPointDirection"}

Sample Code:
{"func":"registerKeyTrigger","values":[{"type":"choice","value":"right arrow"}],"next":{"func":"blockMotionPointTowards","values":[{"type":"string","value":"right edge"}],"next":{"func":"blockMotionMove","values":[{"type":"number","value":"5"}]}}} Add to my Backpack


{"func":"valueMotionDirection"}

Direction

"Direction" returns the Actor’s direction, in degrees.

Parameters:

None.

Related Blocks:
{"func":"blockMotionPointDirection"} ,     {"func":"blockMotionPointTowards"}

Sample Code:
{"func":"blockPenDrawText","values":[{"type":"wrapper","func":"valueOpJoin","values":[{"type":"string","value":"X:"},{"type":"wrapper","func":"valueMotionXPosition"},{"type":"string","value":"Y:"},{"type":"wrapper","func":"valueMotionYPosition"},{"type":"string","value":"Direction:"},{"type":"wrapper","func":"valueMotionDirection"}]}]} Add to my Backpack


{"func":"valueMotionAngle"}

Angle

"Angle" returns the Actor’s mathematical angle, in degrees.

Parameters:

None.

Related Blocks:
{"func":"blockMotionPointDirection"} ,     {"func":"blockMotionPointAngle"} ,     {"func":"blockMotionPointTowards"}

Sample Code:
{"func":"blockPenDrawText","values":[{"type":"wrapper","func":"valueOpJoin","values":[{"type":"string","value":"X:"},{"type":"wrapper","func":"valueMotionXPosition"},{"type":"string","value":"Y:"},{"type":"wrapper","func":"valueMotionYPosition"},{"type":"string","value":"Angle:"},{"type":"wrapper","func":"valueMotionAngle"}]}]} Add to my Backpack


{"func":"blockMotionRotationStyle"}

Set Rotation Style

"Set Rotation Style" sets how an Actor behaves when it rotates.

Parameters:

Rotation Style: this parameter will be the Actor"s new rotation style. ‘All around’ makes it follow the rotation angle (e.g. flip upside down when it bounces off a wall), ‘left-right’ only lets it point left or right, and ‘don’t rotate’ makes it always point towards its default direction.

Related Blocks:
{"func":"blockMotionBounceOnEdge"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockMotionRotationStyle","values":[{"type":"choice","value":"left-right"}],"next":{"func":"blockControlForever","containers":[{"func":"blockMotionMove","values":[{"type":"number","value":"10"}],"next":{"func":"blockMotionBounceOnEdge","next":{"func":"blockControlWait","values":[{"type":"number","value":".1"}]}}}]}}} Add to my Backpack


{"func":"blockMotionTurnCW"}

Turn Clockwise

"Turn Clockwise" rotates an Actor the specified number of degrees in the clockwise.

Parameters:

Degrees: this parameter indicates the number of degrees the Actor should turn, in the clockwise direction.

Related Blocks:
{"func":"blockMotionTurnCCW"}

Sample Code:
{"func":"registerCloned","next":{"func":"blockControlForeverIf","values":[{"type":"wrapper","func":"valueVar","name":"Playing"}],"containers":[{"func":"blockMotionMove","values":[{"type":"number","value":"10"}],"next":{"func":"blockControlWait","values":[{"type":"number","value":"1"}],"next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueOpRandom","values":[{"type":"number","value":"1"},{"type":"number","value":"10"}]},{"type":"string","value":"5"}]}],"containers":[{"func":"blockMotionTurnCW","values":[{"type":"string","value":"15"}]}]}}}]}} Add to my Backpack