Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » My code won't start when green flag is pressed
- MarsBURGER27
-
26 posts
My code won't start when green flag is pressed
The code I have is:
When green flag is clicked
(Forever) Change position to x-180 y13
Move forward 10
Move forward 10
Move forward 10
Change to background 2
Change position to x-180 y13
Move forward 10
Move forward 10
Move forward 10
Change to background 4
Change position to x-180 y13
When I press the green flag, this doesn't work
Why?
When green flag is clicked
(Forever) Change position to x-180 y13
Move forward 10
Move forward 10
Move forward 10
Change to background 2
Change position to x-180 y13
Move forward 10
Move forward 10
Move forward 10
Change to background 4
Change position to x-180 y13
When I press the green flag, this doesn't work
Why?
- treinslave
-
23 posts
My code won't start when green flag is pressed
Advance 10
Advance 10
Advance 10
Change to background 2
Change position to x-180y13
Advance 10
Advance 10
Advance 10
Change to background 4
Change position to x-180y13
“Advance 10
Advance 10
Advance 10
Change to background 4
Position x-180y13 ”
It works if you repeat the “Advance 10” three times instead of using the block three times. For the time being, it wakes up all the way before the first advance 10.
Advance 10
Advance 10
Change to background 2
Change position to x-180y13
Advance 10
Advance 10
Advance 10
Change to background 4
Change position to x-180y13
“Advance 10
Advance 10
Advance 10
Change to background 4
Position x-180y13 ”
It works if you repeat the “Advance 10” three times instead of using the block three times. For the time being, it wakes up all the way before the first advance 10.
- treinslave
-
23 posts
My code won't start when green flag is pressed
Actually, I'm Japanese.
Where are you from?
Finally I will speak in Japanese.
「すごい?」
Where are you from?
Finally I will speak in Japanese.
「すごい?」
- deck26
-
1000+ posts
My code won't start when green flag is pressed
How do you know it doesn't work? You don't appear to be using the pen so the sprite will obey all those blocks before the screen is refreshed and the loop runs again. Try adding a wait in the middle of the loop or changing the script so the end position is not the same every time you reach the end of the loop.
- Jlerpy
-
1000+ posts
My code won't start when green flag is pressed
The whole thing is happening faster than you can see. Yes, add some waits in there.
Look what happens if you swap out your “switch background to” blocks for “next backdrop” and add an extra backdrop.
Look what happens if you swap out your “switch background to” blocks for “next backdrop” and add an extra backdrop.
- MarsBURGER27
-
26 posts
My code won't start when green flag is pressed
Thanks for all these responses, guys! I've only been here at Scratch for one day and I can already see that it is a really active and supportive community!
Thank you for the help, and you're right I should add a wait, but what do you mean by “using the pen”? I have sprites, if that's what you're asking.
I am American and I only speak English (as well as a little bit of Spanish), so I have no idea what you just said. But hello and thanks for the help! Actually, I'm Japanese.
Where are you from?
Finally I will speak in Japanese.
「すごい?」
How do you know it doesn't work? You don't appear to be using the pen so the sprite will obey all those blocks before the screen is refreshed and the loop runs again. Try adding a wait in the middle of the loop or changing the script so the end position is not the same every time you reach the end of the loop.
Thank you for the help, and you're right I should add a wait, but what do you mean by “using the pen”? I have sprites, if that's what you're asking.
- deck26
-
1000+ posts
My code won't start when green flag is pressed
It looked like you might be trying to draw a line but obviously not.How do you know it doesn't work? You don't appear to be using the pen so the sprite will obey all those blocks before the screen is refreshed and the loop runs again. Try adding a wait in the middle of the loop or changing the script so the end position is not the same every time you reach the end of the loop.
Thank you for the help, and you're right I should add a wait, but what do you mean by “using the pen”? I have sprites, if that's what you're asking.
Ignore your code and tell us what you're trying to achieve. Code runs very quickly and the frame is only redrawn at the end of the forever loop so all you'll see is the sprite at that position and background 4 - you won't see anything else that happens during the loop since Scratch is not redrawing the screen after every block and even if it was it would be so quick you'd only see one state.
- lets_fnf
-
2 posts
My code won't start when green flag is pressed
help I'm having the same problem my code is not running at all the green flag won't go to the grayed-out version it is supposed to go to whenever you click it, nor will the stop sign work. also if your wondering what code I'm using it's the final version of Griffpatch's platformer tutorial first episode
Last edited by lets_fnf (July 15, 2024 11:26:33)
- Jlerpy
-
1000+ posts
My code won't start when green flag is pressed
help I'm having the same problem my code is not running at all the green flag won't go to the grayed-out version it is supposed to go to whenever you click it, nor will the stop sign work. also if your wondering what code I'm using it's the final version of Griffpatch's platformer tutorial first episode
Don't necropost on old threads. Start a new thread, and share your project there, so we can see what's happening with your code.
- lets_fnf
-
2 posts
My code won't start when green flag is pressed
wait this is old where can I find how old it is.help I'm having the same problem my code is not running at all the green flag won't go to the grayed-out version it is supposed to go to whenever you click it, nor will the stop sign work. also if your wondering what code I'm using it's the final version of Griffpatch's platformer tutorial first episode
Don't necropost on old threads. Start a new thread, and share your project there, so we can see what's happening with your code.
- deck26
-
1000+ posts
My code won't start when green flag is pressed
Look at the date and time of the first post!wait this is old where can I find how old it is.help I'm having the same problem my code is not running at all the green flag won't go to the grayed-out version it is supposed to go to whenever you click it, nor will the stop sign work. also if your wondering what code I'm using it's the final version of Griffpatch's platformer tutorial first episode
Don't necropost on old threads. Start a new thread, and share your project there, so we can see what's happening with your code.
- Jlerpy
-
1000+ posts
My code won't start when green flag is pressed
wait this is old where can I find how old it is.help I'm having the same problem my code is not running at all the green flag won't go to the grayed-out version it is supposed to go to whenever you click it, nor will the stop sign work. also if your wondering what code I'm using it's the final version of Griffpatch's platformer tutorial first episode
Don't necropost on old threads. Start a new thread, and share your project there, so we can see what's happening with your code.
If you look at the first post, it's from 2022.
- Discussion Forums
- » Help with Scripts
-
» My code won't start when green flag is pressed