From Test-Scratch-Wiki

(Redirected from Eng:Hide)

Hide
2.0 Hide.png
Category Looks
Type Stack

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.

Example Uses

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 clicked
switch to costume [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 to costume [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

Workaround

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.

If the workaround is used, the Show block will not work. The ghost effect must then be set to 0.

Also, sprites cannot evaluate some scripts such as say or ask while in hide mode, however they can using the ghost effect.

Another workaround is switching the costume to a blank one.

switch costume to [blank costume v]

See Also

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