Hi All
I have various "visible to all" variables (a countdown timer, some scoring etc). When a sprite is clicked it displays these values in a speech bubble using the "when sprite clicked" block.
I initialise my variables using "When green flag clicked" which is fine. But if I press the Red Stop button I can still click on the sprites and show the last values. In fact they are actually saved even if I close Scratch and reopen the project!
Is there any way to detect that the Red Stop Button has been pressed and clear these variables? Or should I use the workaround for the When Sprite Clicked block shown here
http://wiki.scratch.mit.edu/wiki/When_%28%29_Clicked_%28block%29 ?
In an ideal world the "when sprite clicked" wouldn't work if the Green Flag hadn't been clicked - but I can't think of any way of testing for this without using a variable (which then won't get reset when Red Button is clicked etc)...
Cheers
MKP1
Offline
Well, using the workaround is definitely an option, but it still won't reset anything. The key is to have all variables and lists reset when the green flag is clicked. There is no way to do anything after the stop sign is clicked, or stop all script is used. If it is vital to have it clear before ending, which it shouldn't be if you reset with the gf, do what Borrego6165 did in Generations4001 Gold. He made it where all variables had to be set a certain way before saving, and to do that, just press the space key. Hope that helps you some.
Offline
If the variables themselves don't matter, as long as you can't view them by clicking on the sprites, then yes, I would use the workaround. There is no way to activate certain scripts when the stop sign is pressed.
Edit: alternatively, because the timer does not stop when the stop sign is pressed, you could have the following code instead of what you have now:
when gf clicked forever reset timer when [sprite1 v] clicked if<(timer) < (0.4)> say the variable value else reset the variables end
Last edited by MoreGamesNow (2012-09-25 18:21:16)
Offline
Offline