Discuss Scratch

iSCRATCH456
Scratcher
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
TheNoisyNoisy
Scratcher
100+ posts

Hide variables when game stops

hide variable [var v]
iSCRATCH456
Scratcher
21 posts

Hide variables when game stops

TheNoisyNoisy wrote:

hide variable [var v]
Yeah, I've tried that, but how do I hide it when the stop button is clicked?
TheNoisyNoisy
Scratcher
100+ posts

Hide variables when game stops

iSCRATCH456 wrote:

TheNoisyNoisy wrote:

hide variable [var v]
Yeah, I've tried that, but how do I hide it when the stop button is clicked?
when this sprite clicked
hide variable [var v]
im so dumb i thought you meant a literal stop button not the ui stop button

Last edited by TheNoisyNoisy (July 30, 2024 15:41:26)

bRuHbRuHmEmEmAn
Scratcher
500+ posts

Hide variables when game stops

iSCRATCH456 wrote:

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
This is a simple “stop button clicked” detector.
when green flag clicked
forever
set [timer v] to (timer)
end

when [timer v] > (timer :: variables)
... // Code goes here
Using 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!
iSCRATCH456
Scratcher
21 posts

Hide variables when game stops

bRuHbRuHmEmEmAn wrote:

iSCRATCH456 wrote:

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
This is a simple “stop button clicked” detector.
when green flag clicked
forever
set [timer v] to (timer)
end

when [timer v] > (timer :: variables)
... // Code goes here
Using 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!
Sorry it took me so long to reply, but when you say “code goes here”, what code do you mean?
(EDIT: Nevermind, I figured it out. Thank you so much!!!)

Last edited by iSCRATCH456 (July 30, 2024 19:36:43)

Powered by DjangoBB