From Test-Scratch-Wiki
(Redirected from Eng:Switch to Costume ())
Switch Costume to () | |
Category | Looks |
Type | Stack |
The Switch Costume to () block is a Looks block and a Stack block. The block changes its sprite's costume to a specified one.
This block is one of the most commonly used blocks; it 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 list). A variable (or any reporter) containing a number or the name of a costume can be dropped in.
The Stage's version is Switch Backdrop to ().
History
In very early, unreleased versions of Scratch, this block was called Look Like (). This original name is also the reason why its Squeak method is called lookLike: for compatibility with projects made with older versions of Scratch.
Example Uses
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. It can be used in animations, games, simulations, or anything that requires changes between costumes.
Some common uses are as follows:
- Simply changing a costume
when I receive [Broadcast v] switch to costume [costume2 v] go to x: (0) y: (0) show
- Changing a costume as part of a sequence
wait until <(variable) = [50]> change x by (10) switch to costume [costume1 v]
Workaround
- Main article: List of Block Workarounds
This block can be replicated with the following code:
repeat until <(wanted costume #) = (costume #)> next costume end
However, it is normally much faster to use the original block.
See Also
For sprites |
Say () for () Secs
• Say () • Think () for () Secs • Think () • Show • Hide • Switch Costume to () • Next Costume • Switch Backdrop to () • Change () Effect by () • Set () Effect to () • Clear Graphic Effects • Change Size by () • Set Size to ()% • Go to Front • Go Back () Layers • Costume # • Backdrop Name • Size |
For the Stage |