break
, let
, await
etc."
xPos()
or size()
//
at the begining of the linewhenGreenFlagClicked()
setVar("correct?", 0)
repeatUntil (=($correct?, 1)) {
ask("What is 1 + 1?")
if (=(answer(), 2)) {
sayForSecs("You got it right!", 2)
setVar("correct?", 1)
} else {
sayForSecs("You got it wrong...", 2)
}
}
moveSteps(10)
Scripts are sections of code begining with a hat block. For example, the whenGreenFlagClicked()
block is a hat block.
To seperate scripts, use a blank line. For example:
whenGreenFlagClicked()
moveSteps(10)
whenKeyPressed("space")
sayForSecs("You pressed space!", 2)
repeat
, repeatUntil
, while
, if
, and forever
use curly braces {}
For example, to make a loop that repeats until the mouse is down, you would do:
repeatUntil (mouseDown()) {
[more stuff here]
}
To do an else for an if, just add } else {
if (condition) {
[code]
} else {
[more code]
}
Variables and lists are created as you use them.
For example, to create and set a variable to the users input, you would do:
ask("what")
setVar("mycoolvar", answer())
For a list, creating and adding a item to a list would be:
addToList("myitem", "mycoolist")
The same applies for the other list and variable functions
To reference a variable or list, you would do $varname
for variables or #listname
for lists
Note: "reference" in this case means when reading out the value to use in another block. For blocks that change/edit the value, use a string quoted name as an argument
You can add sprites by clicking the "New Sprite" button
I think that's it