(Redirected from Eng:Background Number (block))
- The correct title of this article is Backdrop # (block). The change of name is due to technical restrictions.
- This eng is about the block. For more information on the value this block reports, see Costume Number (value).
The Backdrop # block is a Looks Block and a Reporter Block. This block holds the current backdrop number. In Scratch 1.x, this block appeared for both the stage and sprites. However, in Scratch 2.0 it only is in the stage's block palette. The workaround for allowing sprites to obtain the block is to simply drag it from the stage's scripts over to the sprite, using either the backpack or another transferring method. The version for sprites is Costume #. "Costume #", reversely, cannot be used in the stage; if tried, a Script Error will be thrown.
This block can be displayed as a stage monitor.
Prior to Scratch 2.0, this block was called Background #. Unlike the other backdrop blocks, this only changed its name, not its function.
As this block holds the backdrop number of the Stage, it is used when something must happen if the Stage is at a specific backdrop. Some more common uses:
- Stopping the project once the Stage reaches the backdrop for the end of the project
when gf clicked wait until <(backdrop #) = (6)> stop [all v]
- Checking what the current backdrop is
say (join [The current backdrop is: ](backdrop #))
- Setting a variable to the backdrop scene
set [level v] to (backdrop #)
- Main article: List of Block Workarounds
This block can simply be replicated with the following code
([backdrop # v] of [Stage v])
This workaround is useful whenever a sprite needs to detect the current backdrop number.
- Backdrop Name
- Costume # (block)
- Costume # (value)
- Next Backdrop
- Switch Backdrop to ()
- Switch Backdrop to () and Wait
- When Backdrop Switches to ()
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|