C Block

From the Scratch Wiki — made by Scratchers, for Scratchers.
Jump to: navigation, search
The general shape of a C block.
A C block (also known as a Wrap block) is a block that is shaped like a "C", so other blocks can fit inside it. These blocks perform the conditions and loops.

Shape

C blocks are made up of mouths (Cs) — the blocks that will be played with the C block go in these mouths. All but one of the C blocks consist of one mouth — the other, If (), Else, consists of two mouths. When any of the other C blocks are dragged over a stack of blocks — if the C is empty — its mouth extends to wrap around them.

repeat (10)
repeat until <loud?>
glide (1) secs to x: (10) y: (0)
wait (1) secs
go to x: (0) y: (0)
end
play sound [meow v] until done
end

In 1.2.1 and earlier, C-block scripts could only be built one block at a time.

Blocks

There are six C blocks, and they can all be found in the Control category.

Uses

As C blocks are for checks and loops, they are used almost everywhere. Some include:

  • Things that must go on forever
  • Checking a condition
  • Repeating an animation a certain amount of times

Here is an example for both checks and looping:

when I receive [Decrease health v]
change [Health v] by (-1)
if <(health) = [0]>
repeat (8)
change [color v] effect by (25)
end
end

There is a check (the If () block is checking if the variable Health has a value of 0), and inside the check is a repeat loop (with the Repeat () block). Note how C blocks can be placed inside other C blocks.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox