Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Hide variables when game stops
- iSCRATCH456
-
21 posts
Hide variables when game stops
So I have a game with 2 variables and I want it to be when the stop button is clicked, it hides them. Is there any way to do that?
variabubbles lol
variabubbles lol
- iSCRATCH456
-
21 posts
Hide variables when game stops
Yeah, I've tried that, but how do I hide it when the stop button is clicked?hide variable [var v]
- TheNoisyNoisy
-
100+ posts
Hide variables when game stops
Yeah, I've tried that, but how do I hide it when the stop button is clicked?hide variable [var v]
when this sprite clickedim so dumb i thought you meant a literal stop button not the ui stop button
hide variable [var v]
Last edited by TheNoisyNoisy (July 30, 2024 15:41:26)
- bRuHbRuHmEmEmAn
-
500+ posts
Hide variables when game stops
This is a simple “stop button clicked” detector. So I have a game with 2 variables and I want it to be when the stop button is clicked, it hides them. Is there any way to do that?
variabubbles lol
when green flag clickedUsing this code, once you click the stop button, it will look like the project is still running, but because you're using a timer variable (sensing), the project will still run. However, variables will stop changing once the stop button is clicked, causing the “when timer > timer” section to execute. Hope this helps!
forever
set [timer v] to (timer)
end
when [timer v] > (timer :: variables)
... // Code goes here
- iSCRATCH456
-
21 posts
Hide variables when game stops
Sorry it took me so long to reply, but when you say “code goes here”, what code do you mean?This is a simple “stop button clicked” detector. So I have a game with 2 variables and I want it to be when the stop button is clicked, it hides them. Is there any way to do that?
variabubbles lolwhen green flag clickedUsing this code, once you click the stop button, it will look like the project is still running, but because you're using a timer variable (sensing), the project will still run. However, variables will stop changing once the stop button is clicked, causing the “when timer > timer” section to execute. Hope this helps!
forever
set [timer v] to (timer)
end
when [timer v] > (timer :: variables)
... // Code goes here
(EDIT: Nevermind, I figured it out. Thank you so much!!!)
Last edited by iSCRATCH456 (July 30, 2024 19:36:43)
- Discussion Forums
- » Help with Scripts
-
» Hide variables when game stops