Sensing Blocks

Visibility

{"func":"valueSensingTouchingSprite"}

Touching

"Touching" returns true if the Actor is touching the parameter and false otherwise.

Parameters:

None.

Related Blocks:
{"func":"valueSensingTouchingCloneOf"} ,     {"func":"valueSensingTouchingColor"} ,     {"func":"valueSensingTouchedActorName"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockControlWaitUntil","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"rightedge"}]}],"next":{"func":"blockLooksThinkFor","values":[{"type":"string","value":"Turnme around!"},{"type":"number","value":"5"}]}}} Add to my Backpack


{"func":"valueSensingTouchingCloneOf"}

Touching Clone

"Touching Clone" returns true if the current Actor is touching a clone of the Actor specified by the parameter.

Parameters:

Actor: "Touching Clone" checks if the Actor whose code you are editing is touching a clone of this parameter, which should be the name of an original, non-cloned Actor.

Related Blocks:
{"func":"valueSensingTouchingSprite"} ,     {"func":"valueSensingTouchingColor"} ,     {"func":"valueSensingTouchedActorName"}

Sample Code:
{"func":"blockControlForever","containers":[{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpOr","values":[{"type":"wrapper","func":"valueSensingTouchingCloneOf","values":[{"type":"string","value":"Ball"}]},{"type":"wrapper","func":"valueSensingTouchingColor","values":[{"type":"color","value":"#ffffff"}]}]}],"containers":[{"func":"blockControlBroadcast","values":[{"type":"string","value":"AddPoint"}]}]}]} Add to my Backpack


{"func":"valueSensingTouchedActorName"}

Name of Actor Touched

"Name of Actor Touched" returns the name of the Actor that the current Actor is touching.

Parameters:

None.

Related Blocks:
{"func":"valueSensingTouchingSprite"} ,     {"func":"valueSensingTouchingCloneOf"} ,     {"func":"valueSensingTouchingColor"}

Sample Code:
{"func":"registerSpriteCollision","next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpNot","values":[{"type":"wrapper","func":"valueListContains","values":[{"type":"string","value":"ActorsHit"},{"type":"wrapper","func":"valueSensingTouchedActorName"}]}]}],"containers":[{"func":"blockListAdd","values":[{"type":"wrapper","func":"valueSensingTouchedActorName"},{"type":"string","value":"ActorsHit"}]}]}} Add to my Backpack


{"func":"valueSensingTouchingColor"}

Touching Color

"Touching Color" returns true if the Actor is touching the specified color.

Parameters:

Color: this parameter is the color that you want to see if your Actor is touching.

Related Blocks:
{"func":"valueSensingTouchingSprite"} ,     {"func":"valueSensingTouchingCloneOf"} ,     {"func":"valueSensingTouchedActorName"}

Sample Code:
{"func":"blockControlForever","containers":[{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpOr","values":[{"type":"wrapper","func":"valueSensingTouchingCloneOf","values":[{"type":"string","value":"Ball"}]},{"type":"wrapper","func":"valueSensingTouchingColor","values":[{"type":"color","value":"#ffffff"}]}]}],"containers":[{"func":"blockControlBroadcast","values":[{"type":"string","value":"AddPoint"}]}]}]} Add to my Backpack


{"func":"valueSensingSeeColor"}

Color Is Touching

"Color Is Touching" returns true if the first color is touching the second color and false otherwise.

Parameters:

Color1: "Color Is Touching" returns true if this parameter, a color, is touching Color2.

Color2: "Color Is Touching" returns true if this parameter, a color, is touching Color1.

Related Blocks:
{"func":"valueSensingTouchingColor"}

Sample Code:
{"func":"blockControlWaitUntil","values":[{"type":"wrapper","func":"valueSensingSeeColor","values":[{"type":"color","value":"#0000ff"},{"type":"color","value":"#ff0000"}]}],"next":{"func":"blockLooksSay","values":[{"type":"string","value":"Purple!"}]}} Add to my Backpack


{"func":"valueSensingDistanceToSprite"}

Distance To

"Distance To" returns the pixel distance between the current Actor and the parameter.

Parameters:

Object: this parameter indicates the object you are measuring the distance to. Options include "mouse-pointer," any edge of the screen, and any of your Actors.

Related Blocks:
{"func":"valueSensingMouseX"} ,     {"func":"valueSensingMouseY"}

Sample Code:
{"func":"blockMotionChangeYBy","values":[{"type":"wrapper","func":"valueOpSubtract","values":[{"type":"number","value":"0"},{"type":"wrapper","func":"valueSensingDistanceToSprite","values":[{"type":"string","value":"bottomedge"}]}]}]} Add to my Backpack


User Input

{"func":"blockSensingAskAndWait"}

Ask and Wait

"Ask and Wait" asks the user a question and stops all scripts until he/she responds.

Parameters:

Text: this parameter is the text of the question you want to ask.

Related Blocks:
{"func":"valueSensingAnswer"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockSensingAskAndWait","values":[{"type":"string","value":"What's your name?"}],"next":{"func":"blockLooksSayFor","values":[{"type":"string","value":"Hi"},{"type":"wrapper","func":"valueSensingAnswer"},{"type":"string","value":"!"},{"type":"number","value":"5"}]}}} Add to my Backpack


{"func":"blockSensingAskChoices"}

Ask with Choices

"Ask with Choices" asks the user a question and stops all scripts until he/she responds.

Parameters:

Text: this parameter is the text of the question you want to ask.

Choices: one or more parameter to hold the different choices for the question.

Related Blocks:
{"func":"valueSensingAnswer"}

Sample Code:
{"func":"blockSensingAskChoices","values":[{"type":"string","value":"Do you want to continue?"},{"type":"string","value":"Yes"},{"type":"string","value":"No"}],"next":{"func":"blockControlIfElse","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueSensingAnswer"},{"type":"string","value":"Yes"}]}],"containers":[{"func":"blockLooksSayFor","values":[{"type":"string","value":"Great! Let's get started."},{"type":"number","value":"2"}]},{"func":"blockLooksSayFor","values":[{"type":"string","value":"Bye!"},{"type":"number","value":"2"}]}],"containerLabels":[{"type":"wrapper","func":"nop","values":[],"labelText":"else {button:add}"}]}} Add to my Backpack


{"func":"valueSensingAnswer"}

Answer

"Answer" returns the user’s answer to the last question the program asked.

Parameters:

None.

Related Blocks:
{"func":"blockSensingAskAndWait"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockSensingAskAndWait","values":[{"type":"string","value":"What's your name?"}],"next":{"func":"blockLooksSayFor","values":[{"type":"string","value":"Hi"},{"type":"wrapper","func":"valueSensingAnswer"},{"type":"string","value":"!"},{"type":"number","value":"5"}]}}} Add to my Backpack


{"func":"valueSensingMouseX"}

Mouse X

"Mouse X" returns the mouse-pointer’s current X coordinate.

Parameters:

None.

Related Blocks:
{"func":"valueSensingMouseY"}

Sample Code:
{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"containers":[{"func":"blockLooksSay","values":[{"type":"string","value":"X:"},{"type":"wrapper","func":"valueSensingMouseX"},{"type":"string","value":"Y:"},{"type":"wrapper","func":"valueSensingMouseY"}]}]} Add to my Backpack


{"func":"valueSensingMouseY"}

Mouse Y

"Mouse Y" returns the mouse-pointer’s current Y coordinate.

Parameters:

None.

Related Blocks:
{"func":"valueSensingMouseX"}

Sample Code:
{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"containers":[{"func":"blockLooksSay","values":[{"type":"string","value":"X:"},{"type":"wrapper","func":"valueSensingMouseX"},{"type":"string","value":"Y:"},{"type":"wrapper","func":"valueSensingMouseY"}]}]} Add to my Backpack


{"func":"valueSensingMouseDown"}

Mouse Down?

"Mouse Down?" returns true if the user is pressing the mouse-pointer and false otherwise.

Parameters:

None.

Related Blocks:
{"func":"valueSensingKeyPressed"}

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


{"func":"valueSensingKeyPressed"}

Key Pressed?

"Key Pressed?" returns true if the user is pressing the specified key and false otherwise.

Parameters:

Key: this is the key that you want to check if the user pressed. Options include "up arrow," "down arrow," "left arrow," "right arrow," "space," "return,"and any letters or numbers.

Related Blocks:
{"func":"valueSensingMouseDown"}

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


Accelerometer

{"func":"valueSensingTiltAngle"}

Tilt Angle

"Tilt Angle" returns angle of the device tilt.

Related Blocks:
{"func":"valueSensingTiltAmount"}

Sample Code:
{"func":"blockControlForever","containers":[{"func":"blockMotionPointAngle","values":[{"type":"wrapper","func":"valueSensingTiltAngle"}],"next":{"func":"blockMotionMove","values":[{"type":"wrapper","func":"valueSensingTiltAmount"}]}}]} Add to my Backpack


{"func":"valueSensingTiltAmount"}

Tilt Amount

"Tilt Amount" returns amount of the device tilt.

Related Blocks:
{"func":"valueSensingTiltAngle"}

Sample Code:
{"func":"blockControlForever","containers":[{"func":"blockMotionPointAngle","values":[{"type":"wrapper","func":"valueSensingTiltAngle"}],"next":{"func":"blockMotionMove","values":[{"type":"wrapper","func":"valueSensingTiltAmount"}]}}]} Add to my Backpack


{"func":"valueSensingAccelerometerX"}

X Tilt

"Tilt Amount" returns amount of the device horizontal tilt.

Related Blocks:
{"func":"valueSensingAccelerometerY"}

Sample Code:
{"func":"blockControlIfElse","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueSensingAccelerometerX"},{"type":"string","value":"0"}]}],"containers":[{"func":"blockMotionChangeXBy","values":[{"type":"number","value":"10"}]},{"func":"blockMotionChangeXBy","values":[{"type":"number","value":"-10"}]}],"containerLabels":[{"type":"wrapper","func":"nop","values":[],"labelText":"else {button:add}"}]} Add to my Backpack


{"func":"valueSensingAccelerometerY"}

Y Tilt

"Tilt Amount" returns amount of the device vertical tilt.

Related Blocks:
{"func":"valueSensingAccelerometerX"}

Sample Code:
{"func":"blockControlIfElse","values":[{"type":"wrapper","func":"valueOpGreater","values":[{"type":"wrapper","func":"valueSensingAccelerometerY"},{"type":"string","value":"0"}]}],"containers":[{"func":"blockMotionChangeYBy","values":[{"type":"number","value":"10"}]},{"func":"blockMotionChangeYBy","values":[{"type":"number","value":"-10"}]}],"containerLabels":[{"type":"wrapper","func":"nop","values":[],"labelText":"else {button:add}"}]} Add to my Backpack


Time

{"func":"blockSensingResetTimer"}

Reset Timer

"Reset Timer" resets the timer so that it is paused at 0:00.

Parameters:

None.

Related Blocks:
{"func":"valueSensingTimer"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockSensingResetTimer"}} Add to my Backpack


{"func":"valueSensingTimer"}

Timer

"Timer" returns the timer’s current value (how much time as passed since the timer was last reset).

Parameters:

None.

Related Blocks:
{"func":"blockSensingResetTimer"}

Sample Code:
{"func":"blockLooksSay","values":[{"type":"wrapper","func":"valueSensingTimer"}]} Add to my Backpack


{"func":"valueSensingDateTime"}

Date/Time

"Date/Time" returns the property specified by the first parameter having to do with the date/time.

Parameters:

Date property: this parameter is the property you want to retrieve regarding the current date or time. Options include "year," "month," "day," "hours," "minutes," "seconds," "milliseconds," "unix time," and "text." "Text" returns the current time in string format, such as "15:16:21 GMT-0700 (PDT)."

Sample Code:
{"func":"blockLooksSay","values":[{"type":"wrapper","func":"valueSensingDateTime","values":[{"type":"choice","value":"text"}]}]} Add to my Backpack


Actor Properties

{"func":"blockSensingSpriteProperty"}

Set Property Of

"Set Property Of" sets the property of the actor specified by the first parameter to the value of the second parameter. If you attempt to set a property that doesn't exist, such as the volume of the mouse-pointer, this code block does nothing.

Parameters:

Actor: this is the Actor whose Property you want to set. Options include "mouse-pointer," any of the edges, and any of your Actors.

Property: this is the property that you want to set. Options include "x position," "y position," "direction," "costume #," "size," "volume," "width," and other physical properties.

Related Blocks:
{"func":"valueSensingSpriteProperty"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockSensingSpriteProperty","values":[{"type":"choice","value":"x position"},{"type":"string","value":"actor"},{"type":"string","value":"50"}]}} Add to my Backpack


{"func":"valueSensingSpriteProperty"}

Property of

"Property of" returns the property specified by the first parameter of the object specified by the second parameter. If you attempt to retrieve a property that doesn"t exist, such as the volume of the mouse-pointer, this code block returns nothing.

Parameters:

Property: this is the property that you want to receive. Options include "x position," "y position," "direction," "costume #," "size," "volume," "width," and other physical properties.

Actor: this is the Actor whose Property you want to receive. Options include "mouse-pointer," any of the edges, and any of your Actors.

Related Blocks:
{"func":"valueSensingMouseX"} ,     {"func":"valueSensingMouseY"}

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


{"func":"valueSensingActorName"}

My Actor Name

"My Actor Name" returns the name of the current Actor.

Related Blocks:
{"func":"valueSensingNumActors"} ,     {"func":"valueControlLastClonedActor"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockLooksSayFor","values":[{"type":"string","value":"Hello, I'm "},{"type":"wrapper","func":"valueSensingActorName"},{"type":"string","value":"."},{"type":"number","value":"2"}]}} Add to my Backpack


{"func":"valueSensingActorNameAt"}

Name of Actor

"Name of Actor" returns the name of the specified Actor.

Parameters:

Actor: this parameter is the number of the Actor whose name you want to retrieve. Your first Actor"s number is 1. If you use a number that exceeds the number of Actors you have, the code block will return the name of your last Actor. If you use 0 or a negative number, the code block will return the name of your first Actor.

Related Blocks:
{"func":"valueSensingNumActors"} ,     {"func":"valueControlLastClonedActor"}

Sample Code:
{"func":"blockLooksSetLabel","values":[{"type":"wrapper","func":"valueSensingActorNameAt","values":[{"type":"wrapper","func":"valueSensingNumActors"}]}]} Add to my Backpack


{"func":"valueSensingNumActors"}

# of Actors

"# of Actors" returns the total number of Actors in the current program.

Parameters:

None.

Related Blocks:
{"func":"valueSensingActorNameAt"} ,     {"func":"valueControlLastClonedActor"}

Sample Code:
{"func":"blockLooksSetLabel","values":[{"type":"wrapper","func":"valueSensingActorNameAt","values":[{"type":"wrapper","func":"valueSensingNumActors"}]}]} Add to my Backpack


User Properties

{"func":"valueSensingUserId"}

User ID

"User ID" returns the user ID of the user running your program.

Parameters:

None.

Sample Code:
{"func":"blockLooksSayFor","values":[{"type":"string","value":"Hi "},{"type":"wrapper","func":"valueSensingUserId"},{"type":"string","value":""},{"type":"number","value":"2"}]} Add to my Backpack


{"func":"valueSensingUserFirstName"}

User First Name

"User First Name" returns the first name of the user running your program.

Parameters:

None.

Sample Code:
{"func":"blockLooksSayFor","values":[{"type":"string","value":"Hi "},{"type":"wrapper","func":"valueSensingUserFirstName"},{"type":"string","value":""},{"type":"number","value":"2"}]} Add to my Backpack


Screen Size

{"func":"valueSensingScreenLeft"}

Screen Left

"Screen Left" returns the X coordinate of the left border.

Parameters:

None.

Related Blocks:
{"func":"valueSensingScreenRight"} ,     {"func":"valueSensingScreenTop"} ,     {"func":"valueSensingScreenBottom"}

Sample Code:
{"func":"blockControlForeverIf","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"wrapper","func":"valueOpOr","values":[{"type":"wrapper","func":"valueSensingScreenRight"},{"type":"wrapper","func":"valueSensingScreenLeft"}]}]}],"containers":[{"func":"blockControlBroadcast","values":[{"type":"string","value":"GameOver"}]}]} Add to my Backpack


{"func":"valueSensingScreenRight"}

Screen Right

"Screen Right" returns the X coordinate of the right border.

Parameters:

None.

Related Blocks:
{"func":"valueSensingScreenLeft"} ,     {"func":"valueSensingScreenTop"} ,     {"func":"valueSensingScreenBottom"}

Sample Code:
{"func":"blockControlForeverIf","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"wrapper","func":"valueOpOr","values":[{"type":"wrapper","func":"valueSensingScreenRight"},{"type":"wrapper","func":"valueSensingScreenLeft"}]}]}],"containers":[{"func":"blockControlBroadcast","values":[{"type":"string","value":"GameOver"}]}]} Add to my Backpack


{"func":"valueSensingScreenTop"}

Screen Top

"Screen Top" returns the Y coordinate of the top border.

Parameters:

None.

Related Blocks:
{"func":"valueSensingScreenLeft"} ,     {"func":"valueSensingScreenRight"} ,     {"func":"valueSensingScreenBottom"}

Sample Code:
{"func":"blockControlForever","containers":[{"func":"blockMotionGoTo","values":[{"type":"wrapper","func":"valueOpRandom","values":[{"type":"wrapper","func":"valueSensingScreenLeft"},{"type":"wrapper","func":"valueSensingScreenRight"}]},{"type":"wrapper","func":"valueOpRandom","values":[{"type":"wrapper","func":"valueSensingScreenBottom"},{"type":"wrapper","func":"valueSensingScreenTop"}]}],"next":{"func":"blockPenStamp","next":{"func":"blockControlWait","values":[{"type":"number","value":"1"}]}}}]} Add to my Backpack


{"func":"valueSensingScreenBottom"}

Screen Bottom

"Screen Bottom" returns the Y coordinate of the bottom border.

Parameters:

None.

Related Blocks:
{"func":"valueSensingScreenLeft"} ,     {"func":"valueSensingScreenRight"} ,     {"func":"valueSensingScreenTop"}

Sample Code:
{"func":"blockControlForever","containers":[{"func":"blockMotionGoTo","values":[{"type":"wrapper","func":"valueOpRandom","values":[{"type":"wrapper","func":"valueSensingScreenLeft"},{"type":"wrapper","func":"valueSensingScreenRight"}]},{"type":"wrapper","func":"valueOpRandom","values":[{"type":"wrapper","func":"valueSensingScreenBottom"},{"type":"wrapper","func":"valueSensingScreenTop"}]}],"next":{"func":"blockPenStamp","next":{"func":"blockControlWait","values":[{"type":"number","value":"1"}]}}}]} Add to my Backpack


{"func":"valueSensingStageProperty"}

Stage Property

"Stage Property" returns the specified property of the Stage.

Parameters:

Property: this parameter is the property of the Stage you want to retrieve. Options include "width," "height," "left," "right," "top," and "bottom."

Related Blocks:
{"func":"valueSensingSpriteProperty"} ,     {"func":"valueVarPropGet"}

Sample Code:
{"func":"blockMotionGoTo","values":[{"type":"wrapper","func":"valueOpDivide","values":[{"type":"wrapper","func":"valueSensingStageProperty","values":[{"type":"choice","value":"width"}]},{"type":"number","value":"2"}]},{"type":"number","value":"0"}]} Add to my Backpack