(Redirected from Switch To Costume () (block))
|Switch Costume to ()|
switch costume to ( v)
This block is used whenever a sprite must switch to a specific costume (instead of the next costume block, which only switches to the next costume in the costume list). A variable (or any reporter) containing a number or the name of a costume can be dropped in.
In very early, unreleased beta versions of Scratch, this block was called Look Like (). This original name is also the reason why its Squeak method was titled
Because of its simplicity, this block does not have a specific list of main uses — it is simply used to change the costume of a sprite.
Some common uses are as follows:
- Simply changing a costume
when I receive [Broadcast v] switch costume to (costume2 v) go to x: (0) y: (0) show
- Changing a costume as part of a sequence
wait until <(variable) = > change x by (10) switch costume to (costume1 v)
- Main article: List of Block Workarounds
This block can be replicated with the following code:
repeat until <(wanted costume #) = (costume [number v])> next costume end
However, it is normally much faster to use the original block.
Things Worth Noting
Naming Costume As a Number
When naming a costume as a number, Scratch will be confused if costumes are switched via variable:
switch costume to (variable)
Especially if the variable is a number.
If possible, costumes should not be named as numbers, as this will eliminate the ability to change to a costume via its number, changing to a different costume instead.
Effects of Too Many Layers on a Costume Switch
Sometimes, a costume will not switch to the desired costume. This is usually an effect of the use of layers. Large amounts of layers have a tendency to create immense lag, and therefore on less powerful computers/machines, this can cause a delay between switches in costume appearance.
Say () for () Seconds • Say () • Think () for () Seconds • Think () • Switch Costume to () • Next Costume • Switch Backdrop to () Next Backdrop • Change Size by () • Set Size to ()% • Change () Effect by () • Set () Effect to () • Clear Graphic Effects • Show • Hide • Go to () Layer • Go () () Layers • Costume # • Backdrop Number • Size
|For the Stage|