- The correct title of this article is Costume # (block). The Scratch Wiki uses this different title because of technical restrictions.
- This article is about the block. For more information on the value this block reports, see Costume Number (value).
|Introduced in||Scratch 1.2|
The Costume # block is a Looks Block and a Reporter Block. The block holds its sprite's current costume number. Since this block is for both sprites and the Stage, and sprites have costumes while the Stage has backgrounds, there needs to be two different versions of the block. One for sprites and one for the Stage. The version for the Stage is Background #. Each version can not be used as a substitute for the other version. If tried, the script will not run.
This block can be displayed as a Stage monitor.
As this block holds the costume number of sprites, it is widely used when something must happen if a sprite is at a specific costume. Some more common uses:
- Stopping the project once a health sprite reaches the costume for zero health
if <(costume #) = > then//Zero health costume number goes here. stop [all v] end
- Checking if a sprite is at its last costume
if <(costume #) = > then//Last costume number goes here. . . . end
- Setting a variable to the current costume
set [variable v] to (costume #)
- Main article: List of Block Workarounds
This block can simply be replicated with the following code:
([costume # v] of [wanted sprite v])
However, the only way to obtain the same sprite that is selected within the block's attribute is to create the block in another sprite and drag it into the desired. Sprites cannot select themselves from a drop-down list, though other sprites can and then copy the block into the original sprite.
Say () for () Secs • Say () • Think () for () Secs • 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|