(The literal replacement of Switch to Background () in 2.0.)
 
(Automated edit: fixed 1 style guideline)
(24 intermediate revisions by 12 users not shown)
Line 1: Line 1:
{{unreleased}}
 
 
{{block
 
{{block
| name      = Switch to Scene ()
+
| name      = Switch Backdrop to ()
| image      = File:Switch to scene.png
+
| image      = File:2.0 Switch Backdrop to ().png
 
| category  = [[Looks Blocks|Looks]]
 
| category  = [[Looks Blocks|Looks]]
 
| type      = [[Stack Block|Stack]]
 
| type      = [[Stack Block|Stack]]
 
| added      = 2.0
 
| added      = 2.0
 
}}
 
}}
The '''Switch to Scene ()''' [[Blocks|block]] is a [[Looks Blocks|Looks block]] and a [[Stack Block|Stack block]]. It functions identically to the [[Start Scene () (block)|Start Scene ()]] block. This block is only available to the Stage, while the other is for all sprites. It is likely that this block is in Looks because [[Switch to Background ()]] was in Looks in the 1.x series, and so provides a natural place to look.
+
The '''Switch Backdrop to ()''' [[Blocks|block]] is a [[Looks Blocks|Looks block]] and a [[Stack Block|Stack block]]. The block changes the [[Stage|Stage's]] [[Backdrops|backdrop]] to the specified one.
  
Prior to [[Scratch 2.0]], this block was called Switch to Background () and didn't fire an event upon running.
+
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)|Next Backdrop]] block, which does not always give the same backdrop). A [[variable]] (or any [[Reporter Blocks|reporter]]) containing a number or the name of a backdrop can be dropped in.
 +
 
 +
A [[sprite]]'s version is [[Switch Costume to ()]].
 +
 
 +
==Set Attributes==
 +
Aside from the attributes of all the backdrops, the two options "previous backdrop" and "next backdrop" are available in the drop-down menu.
 +
 
 +
==History==
 +
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 ().
 +
 
 +
==Example Uses==
 +
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
 +
<scratchblocks>switch backdrop to [level1 v]</scratchblocks>
 +
<scratchblocks>
 +
when backdrop switches to [level1 v] //in a sprite
 +
go to x: (0) y: (0)
 +
</scratchblocks>
 +
* A game over message
 +
<scratchblocks>switch backdrop to [game over v]</scratchblocks>
 +
<scratchblocks>when backdrop switches to [game over v]
 +
hide</scratchblocks>
 +
* Simply changing backdrops
 +
<scratchblocks>switch backdrop to [backdrop2 v]</scratchblocks>
  
 
==Workaround==
 
==Workaround==
 
{{main|List of Block Workarounds}}
 
{{main|List of Block Workarounds}}
Due to the fact that the Start Scene () block works identically, this block can simply be replaced with the other.
+
This block can be replicated with the following code:
<scratchblocks>start scene [scene1 v]</scratchblocks>
 
  
==Example Uses==
+
<scratchblocks>
*Starting a level
+
repeat until <(wanted backdrop #) = (backdrop #)>
<scratchblocks>switch to scene [level1 v] // in the Stage
+
  next backdrop
when scene [level1 v] starts //in a sprite
+
end
go to x:(0) y:(0)
 
 
</scratchblocks>
 
</scratchblocks>
*A game over message
+
However, it is often much faster to use the original block.
<scratchblocks>switch to scene [game over v]
+
 
when scene [game over v] starts
+
It can also be replicated with a sprite that [[stamps]] the new background.
hide
 
</scratchblocks>
 
*Simply changing scenes
 
<scratchblocks>switch to scene [scene2 v]</scratchblocks>
 
  
 
==See Also==
 
==See Also==
*[[Scenes]]
+
* [[Backdrops]]
*[[Start Scene () (block)|Start Scene ()]]
+
* [[Switch Backdrop to () and Wait (block)|Switch Backdrop to () and Wait]]
*[[Start Scene () and Wait (block)|Start Scene () and Wait]]
+
* [[Next Backdrop (block)|Next Backdrop]]
*[[Next Scene (block)|Next Scene]]
+
* [[Backdrop Name (block)|Backdrop Name]]
 +
* [[Backdrop Number (block)|Backdrop #]]
 
{{Looks Blocks}}
 
{{Looks Blocks}}
[[Category:Looks Blocks]][[Category:Scratch 2.0]]
+
[[Category:Looks Blocks]]
 +
[[Category:Backdrops]]
 +
 
 +
[[de:Wechsle zu Bühnenbild () (Block)]]
 +
[[ja:背景を () にする (ブロック)]]

Revision as of 10:58, 10 November 2018

Switch Backdrop to ()
2.0 Switch Backdrop to ().png
Category Looks
Type Stack
Introduced in 2.0

The Switch Backdrop to () block is a Looks block and a Stack block. The block changes the Stage's backdrop to the specified one.

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.

A sprite's version is Switch Costume to ().

Set Attributes

Aside from the attributes of all the backdrops, the two options "previous backdrop" and "next backdrop" are available in the drop-down menu.

History

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 ().

Example Uses

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]

Workaround

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.

See Also