Skip to content

Sensing Module

syeyoung edited this page Jul 16, 2020 · 1 revision

Sensing Module

Sensing module contains blocks defined in Sensing tab except for those blocks related to time

Sensing module can be imported via

Require "Sensing";

Defined Functions

Sensing::isColorTouchingColor(color1: Text, color2: Text) : returns if color` is touching color2 (Expression only)

Sensing::getAttributeOf(attribute: Text, target: Text) : get attribute of target (Expression only)

attribute: pls chk scratch for allowed attributes. can be local variables but it won't work cus textratch thread management target: spritename or _stage_ for stage

Sensing::getLoudness() : get Loudness (Expression only)

Sensing::getAnswer() : get Answer to the question asked by the ask block(Expression only)

Sensing::isMouseDown() : get if mouse is down (Expression only)

Sensing::isKeyPressed(key: Text) : get if key is being pressed (Expression only)

Sensing::isTouchingColor(color: Text) : get if the sprite is touching color (color has to be RGB integer, or hex followed by "#")(Expression only)

Sensing::getMouseY() : get Y coord of mouse (Expression only)

Sensing::setDragMode(mode: Text) : set Dragmode of sprite (mode can be "draggable" or "not draggable")

Sensing::getMouseX() : get X coord of mouse (Expression only)

Sensing::ask(question: Text) : ask question

Sensing::getUsername() : get username of user (Expression only)

Sensing::isTouching(name: Text) : check if sprite is touching named object name (Expression only)

name can be _mouse_: mouse / _edge_: edge / Spritename for sprite named Spritename

Sensing::getDistanceTo(name: Text) : get distance to named object name (Expression only)

name can be _mouse_: mouse / Spritename for sprite named Spritename

Defined Events

N/A

Clone this wiki locally