From Test-Scratch-Wiki

Go Back () Layers
2.0 Go Back () Layers.png
Category Looks
Type Stack

The Go Back () Layers block is a Looks block and a Stack block. The block changes its sprite's layer value by the specified amount. This block is rather unusual compared to other blocks. It moves the layer value back, and not forward. To move it forward instead, a negative number can be used.

Moving Forward Layers

Sprites can also move forward layers using this block. If a negative value is entered into the block, the sprite will move forward the specified number of layers. For example, go back (3) layers moves the sprite back 3 layers, but go back (-3) layers moves the sprite forward 3 layers.

Example Uses

As this block changes its sprite's layer value, it is used whenever a sprite's layer value must be changed, whether forward or backward. Some common uses are:

  • Changing layer values in 3 dimensional scenes and animations
  • Making a sprite go behind another sprite
  • Stacking sprites on top of each other (from a bird's eye view)
  • Creating fancy 3 dimensional illusions

This block is often used in conjunction with the Go to Front block to move a sprite to a specific layer. For example,

go to front
go back (5) layers

moves a sprite to the 6th layer (5 + 1). To reverse,

 
go back (-5) layers

Backmost Layer

Scratchers are often suggesting a "go to back" block since there is a Go to Front block.[1] However, there is a very simple workaround for this:

go back (999) layers

Workaround

This block cannot be practically replicated with other Scratch blocks, due to the fact that there is currently no block that holds the layer value and no block that can set the layer value. However, if both blocks existed, the block could be replicated with the following code:

set layer to ((layer) - (amount)) // category=looks

A rather impractical approach is to use the bring to front block with other sprites to simulate the moving back of a sprite. This should not be depended on because it will mess up any other layering in the project.

See Also


References

Cookies help us deliver our services. By using our services, you agree to our use of cookies.