Sensing functions
Free functions you can call directly in sprite code.
andClones
Section titled “andClones”andClones(): Sprite[]Get this sprite together with all of its clones.
Delegates to Sprite.andClones
askAndWait
Section titled “askAndWait”askAndWait(question: string): voidAsk the user a question and wait for an answer.
Pauses the script (a generator). In sprite code the free-function wrapper awaits it for you.
Delegates to Sprite.askAndWait
colorTouching
Section titled “colorTouching”colorTouching(color: Color, target: any): booleanCheck whether this sprite is touching a given color.
Delegates to Sprite.colorTouching
getAnswer
Section titled “getAnswer”getAnswer(): string | nullGet the most recent answer from askAndWait.
Delegates to Sprite.answer
getLoudness
Section titled “getLoudness”getLoudness(): numberGet the current microphone loudness.
Delegates to Sprite.loudness
getMouseX
Section titled “getMouseX”getMouseX(): numberGet the mouse x position.
Delegates to Sprite.mouse
getMouseY
Section titled “getMouseY”getMouseY(): numberGet the mouse y position.
Delegates to Sprite.mouse
getSprites
Section titled “getSprites”getSprites(): Sprite[]Get all sprites in the project.
Delegates to Sprite.sprites
getStage
Section titled “getStage”getStage(): StageGet the stage object.
Delegates to Sprite.stage
getTimer
Section titled “getTimer”getTimer(): numberGet the value of the project timer in seconds.
Delegates to Sprite.timer
isMouseDown
Section titled “isMouseDown”isMouseDown(): booleanCheck whether the mouse button is down.
Delegates to Sprite.mouse
keyPressed
Section titled “keyPressed”keyPressed(key: string): booleanCheck whether a key is currently pressed.
Delegates to Sprite.keyPressed
nearestEdge
Section titled “nearestEdge”nearestEdge(): stringGet the nearest edge this sprite is touching.
Delegates to Sprite.nearestEdge
restartTimer
Section titled “restartTimer”restartTimer(): voidReset the project timer to zero.
Delegates to Sprite.restartTimer
touching
Section titled “touching”touching(target: "mouse" | "edge" | Sprite): booleanCheck whether this sprite is touching a target, “mouse”, or “edge”.
Delegates to Sprite.touching