(Redirected from Hide)
The Hide block is a Looks block and a Stack block. If the block's sprite is shown, it will hide the sprite — if the sprite is already hidden, nothing happens. This block is one of the simplest and most commonly used Looks blocks. A hidden sprite cannot be touched.
This block is widely used, mainly in preparing scenes and such for a Scratch project. Some common uses are:
- Preparing a scene
when gf clicked hide switch costume to [ghost v] set [ghost v] effect to (100) when I receive [haunted v] show repeat (20) change [ghost v] effect by (-5) end
- Hiding a sprite in front of an object to reveal it
when gf clicked go to front hide when I receive [chest opened v] show say [You found me!] for (2) secs
- Simply hiding a sprite (hide and seek, for example)
when gf clicked say [You know how to play hide-and-seek, correct?] for (3) secs say [Well you're it! Come and find me!] for (3) secs hide go to x: (200) y: (-120) when this sprite clicked show say [You're really good at this!] for (3) secs
- Hiding a bullet once it hits something
when I receive [Shoot! v] show point in direction [mouse pointer v] repeat until <touching [edge v]?> move (8) steps end hide
when this sprite clicked switch costume to [empty-handed v] say [Hello and welcome to the morning news!] for (3) secs say [Oh wait, I forgot something backstage. I'll be back in a sec!] for (4) secs hide wait (2) secs show switch costume to [coffee v] say [Got my coffee! Now, where were we again?] for (2) secs
- The block is also sometimes used simply to hide everything but a menu at the start of a project.
when gf clicked hide
- Main article: List of Block Workarounds
This block can be replicated with the following code:
set [ghost v] effect to (100)
However, this does not completely work, as it can still be sensed. Also, it reappears when the project is stopped or restarted. The hide block prevents the When this sprite clicked from activating but using ghost effects does not.
Also, sprites cannot evaluate some scripts such as say and think while in hide mode, however, they can using the ghost effect. The Ask () and Wait block behaves differently on hidden sprites, the prompt is included in the ask bar.
Another workaround is switching the costume to a blank one.
switch costume to [blank costume v]
One might think hide is a workaround for delete, but this is nothing but a misconception. The hide block only sets the sprite's transparency to 100, whereas deleting a sprite removes it from the sprite library altogether. Another misconception is that hidden sprites will still be detected using the touching blocks. Hidden sprites will not be detected. A workaround that allows detection is to set the sprite's ghost effect to 100.
Say () for () Secs • Say () • Think () for () Secs • Think () • Switch Costume to () • Next Costume • Switch Backdrop to () Next Backdrop • Change Size by () • Set Size to ()% • Change () Effect by () • Set () Effect to () • Clear Graphic Effects • Show • Hide • Go to () Layer • Go () () Layers • Costume # • Backdrop Number • Size
|For the Stage|