Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » On/off mechanic
- hamsandwichthefox
-
5 posts
On/off mechanic
I am designing a game where if you press space it opens or closes a menu, but I am unclear of how to do that. Do you know how to?
- SpeedSpot
-
18 posts
On/off mechanic
You could set a variable with an on/off or 1/0 setting to represent whether it is open or closed.
when green flag clickedI think this would work.
set [Menu v] to [0]
when [space v] key pressed
if <[Menu] = [0]> then
set [Menu v] to [1]
show
else
set [Menu v] to [0]
hide
end
- Discussion Forums
- » Help with Scripts
-
» On/off mechanic