My menu is being all whacked out. About 90% of the tie, if you go in to either 1 player or 2 player, and then hit the green flag again, it will go to the menu but some stuff will be missing or it will show the 1 player and 2 player options that shouldn't be there yet.
HELP!!
http://scratch.mit.edu/projects/i_caught_fire_2/385230
Offline
Bumpity Bumo Bump
Offline
i_caught_fire_2 wrote:
My menu is being all whacked out. About 90% of the tie, if you go in to either 1 player or 2 player, and then hit the green flag again, it will go to the menu but some stuff will be missing or it will show the 1 player and 2 player options that shouldn't be there yet.
HELP!!
http://scratch.mit.edu/projects/i_caught_fire_2/385230
This kind of problem is usually caused by timing issues. Scratch would like you to think that everything under the Green Flag blocks run at the same time but that is not exactly true...some of them will run before others and some scripts will run faster than others. So take a close look at how the project is being initialized with the Green Flag scripts and maybe add in a few Wait 0.5 second blocks here and there to make sure that things are running in an order that makes sense.
For instance, in your project I see a lot of Forever Loops testing on a variable called Play Amount. They start testing on it immediately from Green Flag...but what if the variable value hasn't been initialized to the correct value yet before those loops start looking at it? It would be a very good idea to add a short Wait between the Green Flag and any block that tests on the value of the Play Amount variable.
Hope that helps out some!
Offline
Speaking of which...
I've always been curious about how Scratch handles multiple threads like that... There must be some sort of logic behind how it chooses the order in which to start running each Flag script -- are there any docs on how the interpreter actually runs?
Offline
maybe its which order the scripts are in and the sprites are in. LIke sprite one would be first and so on. and then the topmost script of the first sprite would be first, ect.
Offline
I always thought each script started at the same time, but some blocks took longer to activate than others. Like if you had a forever loop in one script and a set variable script in the other. Then when you start both scripts, it would take longer for the set variable block to activate than the forever loop.
I'm probably wrong, though.
Offline
hmnwilson wrote:
I always thought each script started at the same time, but some blocks took longer to activate than others. Like if you had a forever loop in one script and a set variable script in the other. Then when you start both scripts, it would take longer for the set variable block to activate than the forever loop.
I'm probably wrong, though.
Well, all I'm saying is that without true parallel processing, each script must start sequentially. They may be very close in timing but there has to be very slight differences. You are correct in saying that each block must have different activation times as well. And it is also true that the timing can change a lot between the Scatch application and the Java player. So if you have a series of actions that need to happen sequentially, it is a very good idea to use Wait blocks (or other methods) to insure that they happen the way you want them to.
Offline
mrweston wrote:
Speaking of which...
I've always been curious about how Scratch handles multiple threads like that... There must be some sort of logic behind how it chooses the order in which to start running each Flag script -- are there any docs on how the interpreter actually runs?
There was a discussion on the Forums awhile back...initiated by Deerel I think. I'll look around and see if I can find it.
Here it is...it has a fascinating post from Johnm, the chief developer.
http://scratch.mit.edu/forums/viewtopic.php?pid=72942#p72942
Offline