Backdrop Name (block)
This block can be displayed as a stage monitor.
Prior to Scratch 2.0, this block never existed. Instead, the
(backdrop #) block had to be used (although it was called "background #" instead). Another alternative would be to list each costume name in a list. Both these blocks are now available and can each be used to meet a specific project's needs. One notable difference is that the
(backdrop name) block is available in both the Stage and sprites, while
(backdrop #) is only in the Stage.
This block holds the backdrop name of the Stage, therefore it is used when something must happen if the Stage is at a specific backdrop. Some of the more common uses are:
- Stopping the project once the Stage reaches the backdrop for the end of the project
when gf clicked wait until <(backdrop name) = [The End]> stop [all v]
- Checking what the current backdrop is
if <(backdrop name) = [Level 1]> then say [Welcome to the game! Use WASD to move.] for (4) secs end if <(backdrop name) = [Level Boss]> then say [Watch out for the boss's laser attack!] for (4) secs end
- Setting a variable to the current backdrop
set [(variable name) v] to (backdrop name)This block also gives more meaning to naming backdrops.
- Main article: List of Block Workarounds
This block can simply be replicated with the following code:
([backdrop name v] of [Stage v])
There is currently no dedicated block for accessing a sprite's costume name. However, it can be accessed with the following code:
([costume name v] of [Sprite v])
There is, in fact, the code for the "costume name" block in the source code of Scratch, but it is not normally accessible in the editor.
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|