Eng:When Backdrop Switches to () (block)

The When Backdrop Switches to  block is an Event block and a Hat block. Scripts that wear this block will be triggered once the specified backdrop has been switched to on the Stage.

Example Uses
switch backdrop to [level1 v] when backdrop switches to [level1 v] //in a sprite go to x: (0) y: (0)
 * Starting a level

switch backdrop to [game over v] // in Stage when backdrop switches to [game over v] // in a sprite hide
 * A game over message

switch backdrop to [menu 3 v] when backdrop switches to [menu 3 v] //when "menu 3" is opened go to front //so the menu item displays in the front show //this opens up the menu
 * Switching among menus

Recursion
This block can use recursion to continuously run scripts. An example is as follows: when backdrop switches to [snow storm v] //a background switch must first be triggered to begin the recursion . . . switch backdrop to [sunny day v] //which will trigger the next script

when backdrop switches to [sunny day v] .. . switch backdrop to [snow storm v] //starts the cycle over

Workaround
When the backdrop changes, sprites with the When Backdrop Switches to block, and the attribute as the backdrop being changed to (meaning the selected backdrop within the block is what is being switched to), the sprites will react and run their scripts beginning with this hat block. Broadcasts can be used to replicate this situation, though there may be a miniscule delay due to an extra block being added. The following is a workaround, often used in Scratch 1.x: switch backdrop to [valley v] broadcast [valley v]

when I receive [valley v] .. .