I noticed a different behavior between Snap and Scratch when the green flag is clicked.
In Scratch, clicking the green flag stops all scripts and then restart the scripts starting with "WHEN green flag CLICKED". You can see it at https://scratch.mit.edu/projects/410789669/, where you have to press the space key in order to make the sprite rotate and glide after you click the green flag.
In Snap instead, clicking the green flag does not stop all scripts before restarting the scripts that starts with "WHEN green flag CLICKED". You can see it at Snap! Build Your Own Blocks, where, after you press the space key, the sprite keeps gliding even before you press the space key. In order to get the same behavior as in Scratch, you have to stop the project first, by clicking the STOP button, and then restart it by clicking the green flag.
Is this a wanted behavior in Snap? If so, is there a clever way of using the STOP block in order to add a single script (or to add a script to all sprites) that will make the green flag work exactly as in Scratch?
here's a way to do that
you just need to have all when flag clicked blocks blocks (except this one) be when I receive [start project v] or whatever you want the message to be.
Yes, now the project has the same behavior it has in Scratch. But what I want, if possible, is a separate script to add to a single sprite -or to all sprites- so that the original Snap project (that I restored at Snap! Build Your Own Blocks) will work as the original Scratch project with the same scripts (that is https://scratch.mit.edu/projects/410789669/) without modifying the original scripts.
Thanks a lot, that should work. When I shift-clicked the menu and selected the green flag I got a "green flag clicked" message that didn't work. How did you get the "green flag" message? You just wrote "green flag"?
Won't that require replacing every green flag hat (except the one in that script) with "when I receive [green flag]"? Generally I'd like to stick to converting Scratch blocks to their Snap! equivalents, so that means keeping "when green flag clicked" as "when green flag clicked".
I'm also hesitant to generate entirely new scripts that implement functionality usually provided by the Scratch player. But I'm not entirely opposed to it if there's some way to make it clear to the user where it came from, so they don't accidentally delete it, or come complain to me about weird scripts appearing in their project, or something.
Thanks Brian. I'd rather not change every script in the project if not necessary.
In my first successful test it didn't.
If it works (read below) I guess we could create a custom block, so that it is clear to the user why the script is there.
But I tried @ego-lay_atman-bay's script again in a much larger project with many sprites and many scripts. The script worked well in the small sample project but this time, in the large project, it doesn't work. I also tried adding a wait block after the stop block, but it didn't work either.
I don't understand why having many scripts would interfere. Maybe the STOP ALL BUT THIS SCRIPT block yields to other blocks? I guess @jens knows that. If this is the case, I guess it should become a STOP ALL BUT THIS SCRIPT AND WAIT. There is no point in running the next blocks if all the other scripts have no stopped yet, is there? As I understand it, it should already wait. But I can be wrong.