|Switch Backdrop to ()|
This block is a commonly used block; it is used whenever the Stage must switch to a specific backdrop (instead of the Next Backdrop block, which does not always give the same backdrop). A variable (or any reporter) containing a number or the name of a backdrop can be dropped in.
Aside from the attributes of all the backdrops, the two options "previous backdrop" and "next backdrop" are available in the drop-down menu.
Prior to Scratch 2.0, this block was called Switch to Background () and did not fire an event upon running. During 2.0 development, this block was also called Switch to Scene (), then Switch to Backdrop (), before being finalized on Switch Backdrop to ().
Because of its simplicity, this block does not have a specific list of main uses; it is simply used to change the background of the Stage. It can be used in animations, games, simulations —anything that requires changes between backgrounds.
Some common uses are as follows:
- Starting a level
switch backdrop to [level1 v]
when backdrop switches to [level1 v] //in a sprite go to x: (0) y: (0)
- A game over message
switch backdrop to [game over v]
when backdrop switches to [game over v] hide
- Simply changing backdrops
switch backdrop to [backdrop2 v]
- Main article: List of Block Workarounds
This block can be replicated with the following code:
repeat until <(wanted backdrop #) = (backdrop #)> next backdrop end
However, it is often much faster to use the original block.
It can also be replicated with a sprite that stamps the new background.
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|