From Test-Scratch-Wiki

The layering of two sprites and a variable.

A morph's layer is the justification of sprites or Stage Monitors being shown in front or behind each other. A lower layer value is shown in front, or closer to the viewer, so a layer of "1" appears at the front. When an object is created, it appears at the front, as well as when it is dragged in the project editor.

When there are a lot of sprites in a project, correct layering can become difficult. [citation needed]

The only current way to actually view the layer value of a sprite is to analyze the JSON of a project. It has been suggested to have a block that reports a sprite's layer value.[1]

Monitors' Layers

A monitor's layer changes depending on when it shows. When a stage monitor shows, it immediately is sent to the front layer, but other sprites and monitors can overlap it if they are sent to the front layer. There is not currently a way to directly send a monitor's layer back or forward a specific value without adjusting the layer values of the other sprites.

Related Blocks

The following blocks can be used in conjunction with this value:

— this block sets the layer to the front, "1".

— this block moves the sprite back, raising the layer's value.

— this block not only shows the variable monitor but also sends it to the front.

— this block not only shows the list monitor but also sends it to the front. There are currently no blocks to set the layer directly, nor to report it.

Viewing the Specific Layer Value

Though not available through the Scratch user interface, the specific value of a sprite's layer can be seen through a short process.

  • In the project editor, select File > Download to your computer
  • At the end of the project file name, type in
    .zip
    to archive it into a zipped folder
  • After saving the zipped project, extract the files
  • Open up the JSON file near the bottom of the folder in any text editor (i.e. Notepad++)
  • Within the arranged codes are the layer values for each object, or sprite. The value can be changed directly within the text editor and saved before compressing the zipped file again.

Example Uses

As this value tells sprites where to go, it has many uses. Some example uses:

  • Layering objects and sprites in a scene.
  • Creating 3D scenes.
  • Displaying the terrain of a scrolling project in the background.
  • Displaying menu items in front of the menu.
  • Displaying the score or other variable monitor in front of the project-play.

References

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