From Test-Scratch-Wiki

(Redirected from Eng:Hide Variable ())

Hide Variable ()
2.0 Hide Variable ().png
Category Variables
Type Stack
Introduced in 1.3

The Hide Variable () block is a Variables block and a Stack block. The block hides the specified variable's Stage monitor.

Example Uses

In projects that use variables' Stage monitors to display things, the displays may have to hide and show at times; this can be done with the Show Variable ().

  • Hiding a slider when a value is not editable
when sprite clicked //a button to lock-in or open the value editing
if <(editable) = [yes]>
hide variable [width v]
set [editable v] to [no]
else
show variable [width v]
set [editable v] to [yes]
  • Hiding the score at the end of a game
when gf clicked
set [points v] to (0)
set [status v] to [running]
show variable [points v]
repeat until <not <(status) = [running]>>
go to x: (pick random (-240) to (240)) y: (pick random (-180) to (180))
set [lastTime v] to (timer)
wait until <<((timer) - (lastTime)) > (.3)> or <<mouse down> and <touching [mouse-pointer v]?>>>
if <<mouse down> and <touching [mouse-pointer v]?>> then
change [points v] by (1)
play sound [pop v]
if <(points) = [10]> then
set [status v] to [win]
end
end
if <(timer) > (10)> then
set [status v] to [lose]
end
end
broadcast (status)
wait (2) secs
hide variable [points v]
  • When the variable has no use anymore
when I receive [game end v]
hide variable [score v]

See Also

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