From Test-Scratch-Wiki
Go to Front | |
![]() | |
Category | Looks |
Type | Stack |
The Go to Front block is a Looks block and a Stack block. The block will place a sprite in front of all other sprites. It does this by changing the sprite's layer value.
Example Uses
As this block puts the sprite in front of others, it is widely used in setting up three-dimensional scenes, or placing objects in front of other objects. Some common uses are:
- Putting an object closest to the viewer in 3 dimensional animation
- Making sure an object sprite is on a table sprite by putting the object in the front
- Putting buttons in front of a toolbar
when I receive [show toolbar v] //in the toolbar sprite go to front //so the toolbar's menu is not behind anything show broadcast [tools v] //now tell the tools to show when I receive [tools v] //in each tool sprite go to front //so it is in front of the tool bar show
- Covering one sprite with another
- Simply moving one object in front of another
This block is often used in conjunction with the Go Back () Layers block to move a sprite to a specific layer. For example, this script moves a sprite to the 6th layer from the front (which means there are 5 sprites on top of it):
go to front go back (5) layers
Workaround
- Main article: List of Block Workarounds
This block can be replicated with the following code:
go back ((-1) * ((object count) + (1))) layers
The variable "object count" should be set to the number of objects (sprites, Stage Monitors, etc.) on the Stage.
It can be also replicated with this code:
go back (-999) layers
See Also
For sprites |
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 |