Sometimes, I need to press the green flag twice in order to completely reset everything. If I press it once, then sometimes some things don't get reset. For example, when I press the green flag, the background and variables might reset normally but all the sprites don't hide/show. Am I doing something wrong or is this just a problem with the software.
Thanks
Offline
you're doing nothing wrong. Scratch can act up if there are a lot of variables or data that need to be stored.
Last edited by ROSMan (2012-04-13 20:55:42)
Offline
It can happen to everyone. Most large games, if you look in the project notes, says "press gf twice to reset."h
Offline
Sometimes you need to add a wait 0 seconds to the top of stuff.
Offline
It has to do with the timing of things. You might think that everything that is set up to run when the Green Flag is clicked happens at the same time. But that is not quite the case. Most of our computers are still single-threaded and only do one calculation at a time - so some things happen before others, even if they are set up to the same trigger block.
The cure is to make sure that things that rely on a variable being reset or a sprite being in the right place before they start checking have a Wait block before them, usually with no more than 0.5 seconds delay. So if you have a Forever loop in one part of the code that is looking for a variable to get to a certain value...put a Wait block before it to give the variable time to be reset before it starts looking at it. And make sure the variable is initialized on Green Flag.
Offline
Paddle2See wrote:
It has to do with the timing of things. You might think that everything that is set up to run when the Green Flag is clicked happens at the same time. But that is not quite the case. Most of our computers are still single-threaded and only do one calculation at a time - so some things happen before others, even if they are set up to the same trigger block.
The cure is to make sure that things that rely on a variable being reset or a sprite being in the right place before they start checking have a Wait block before them, usually with no more than 0.5 seconds delay. So if you have a Forever loop in one part of the code that is looking for a variable to get to a certain value...put a Wait block before it to give the variable time to be reset before it starts looking at it. And make sure the variable is initialized on Green Flag.
This. To fix it, I just do what Paddle2See just said, or just make any script that relies on a variable responsible for reseting it. Glad that somebody isn't blaming Scratch
P.S. an advantage of 1s1s is that there is no randomness in the order of which scripts run first/faster
Last edited by MoreGamesNow (2012-04-14 15:15:28)
Offline