From Test-Scratch-Wiki
Backdrop name | |
Category | Looks |
Type | Reporter |
Introduced in | 2.0 |
The Backdrop name block is a Looks Block and a Reporter Block. The block holds the current backdrop name. This is the first time that the costume/backdrop name can be accessed through a block.
This block can be displayed as a stage monitor.
History
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.
Example Uses
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.
Workaround
- Main article: List of Block Workarounds
This block can simply be replicated with the following code:
([backdrop name v] of [Stage v])
See Also
References
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 |