getting started with scratch

CONTROL

Control blocks control the order that blocks run in, including decisions (selection) and loops (repetition).

The wait block delays for a number of seconds before running the next block.

 

 

 

 

 

 

 

 

 

 

 

 

Checking a condition with if inside a forever loop

In Scratch it’s often useful to run code blocks every time a condition becomes true.

You can do this by placing an if block inside a forever block. You will need to trigger the script, for example with a when flag clicked or when I receieve block.

You can check for important conditions in a game:

Tip: You can stop a forever block by clicking the Stop button above the Stage, or by using the stop blocks.

There are three options for the stop block:

The if...then and if...then...else blocks are used to make decisions about which code blocks to run next. This is sometimes called selection. The if...then block checks a hexagonal-shaped condition and runs the code blocks inside, if the condition is true. The if...then..else block has an additional section to run the code blocks inside, if the condition is false.

 

 

 

 

 

 

 

 

 

Using if…then and if…then…else blocks

The blocks inside an if...then block will only run if the condition in the hexagonal input is true.

There are lots of hexagonal shaped condition blocks in Scratch, including blocks in the Sensing and Operators blocks menus.

If you want to run different blocks when the condition is false then use an if...then...else block instead:

You can build more complex checks by ‘nesting’ if...then and if...then...else blocks one inside the other.

You can find hexagonal-shaped blocks to use as conditions in the Operators and Sensing blocks menus.

The wait until and repeat until blocks also use conditions:

A clone is a copy of a sprite, it has the costumes, scripts and sounds held by the sprite it was cloned from at the time of cloning. There are a number of blocks that can be used to clone sprites.

With the create clone of [myself v] block, a sprite can create a clone of itself or of another sprite in the project.

The when I start as a clone hat block is used to trigger a new script once the clone has been created. The clone will exist in the project until the delete this clone cap block is used.

Using the when I start as a clone hat block then including the create clone of [myself v] block in the script underneath means it is also possible for clones to create other clones.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

There is a maximum number of clones a sprite can have at any point, at the time of writing this is 300.

If you want to run different blocks when the condition is false then use an if...then...else block instead:

Clones of clones

Clones: See inside