Discuss Scratch

Bluekitty2001
New to Scratch
6 posts

why doesn't my script start from the beginning every time I press the green flag

I am a beginner, working on a simple story. I have my sprite and am putting down code to make it do things. I test it and then add or delete code blocks and then press the green flag again and it doesn't always start over from the beginning. What am I doing wrong. Please help. I did search help topics but didn't find my answer.
-Upside-
Scratcher
57 posts

why doesn't my script start from the beginning every time I press the green flag

Try double-clicking the green flag. If you share and give the link to the project then we can help better.

☄️ There will be a new signature put up shortly. In the meantime, feel free to drink lemonade. ☄️ Also hi
Bluekitty2001
New to Scratch
6 posts

why doesn't my script start from the beginning every time I press the green flag

Okay I will try that. Thanks and I may share as well but maybe when I get a bit further into it and have some more questions/problems.
Thanks again.
-ShadowOfTheFuture-
Scratcher
1000+ posts

why doesn't my script start from the beginning every time I press the green flag

Lemme guess… does your code look something like this?

when green flag clicked
do something :: #999999
when gf clicked
do something else :: #999999

When you have multiple scripts beginning with “when green flag clicked” event blocks, sometimes they might run in the wrong order when the project is started. For example, if you had one script that set the sprite's position to (0, 0), and another script that increased the x position by 10 units, the second script might run before the first one, resulting in a final position of (0, 0) instead of (0, 10) as was intended.

You can fix this by double-clicking the flag, or by changing the script to only have one “when green flag clicked” block:

when gf clicked
do something :: #999999
then do something else :: #999999

Last edited by -ShadowOfTheFuture- (Feb. 25, 2019 01:24:33)


<Insert uncreative signature here>









██       ██  ██            ██  ██       ██
██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██
███ ███ ██ ████ ██ ███ ███
█████████ █████ █████ █████████

“Though the seasons come and go, and sunshine turns to snow, we will always have tomorrow up ahead.”
Bluekitty2001
New to Scratch
6 posts

why doesn't my script start from the beginning every time I press the green flag

Here is the url of my beginning project. https://scratch.mit.edu/projects/289110121/
RokCoder
Scratcher
1000+ posts

why doesn't my script start from the beginning every time I press the green flag

Bluekitty2001 wrote:

I am a beginner, working on a simple story. I have my sprite and am putting down code to make it do things. I test it and then add or delete code blocks and then press the green flag again and it doesn't always start over from the beginning. What am I doing wrong. Please help. I did search help topics but didn't find my answer.
You need to set the starting position for both sprites. I.e. add the following to the beginning of the fox sprite's script and also add the starting coordinates to the beginning of the owl sprite's script.

go to x: (126) y: (-53)


Scratch dabbling for fun…

Bluekitty2001
New to Scratch
6 posts

why doesn't my script start from the beginning every time I press the green flag

Thanks for this. I am about to start fooling around again with Scratch.
deck26
Scratcher
1000+ posts

why doesn't my script start from the beginning every time I press the green flag

Good practice is to have an initialisation stage to set all variables, sprite costumes etc. Only start game play once the initialisation stage has completed. That cures most (all?) cases where double-clicking the green flag is required, A single green flag script in the whole project is enough in that case.

when green flag clicked
broadcast [initialise v] and wait
broadcast [gameplay v]

Last edited by deck26 (April 20, 2019 20:51:46)

xenbee
Scratcher
15 posts

why doesn't my script start from the beginning every time I press the green flag

Powered by DjangoBB