Discuss Scratch

scratchtay100
Scratcher
100+ posts

Green flag not working!

When I was developing my Flappy Bird game, there was something strange. Every time I clicked the Green Flag, nothing happened. I tried to use a message broadcast to start it up, but it didn't work. The code went like this:

when green flag clicked
go to x: (0) y: (0)
forever
change y by (-1)
end

when green flag clicked
forever
if <<[-159] > (y position)> or <[139] > (y position)>> then
set [fail v] to [true]
stop [all v]
end
end

No matter how many times I clicked the green flag, nothing happened. The script didn't run.

Can anyone help me with this? Please? It's impacting my game and if the Scratch Team sees this, please fix it!
-Scratchtay100 out.

Last edited by scratchtay100 (Nov. 23, 2020 20:48:37)

10goto10
Scratcher
1000+ posts

Green flag not working!

Well, it is kinda a design bug because Scratch does not make it clear which of the two green hat stacks runs first. If the one with the stop all always runs first and your sprite’s Y position true for that if statement then your project will stop and the stack with “goto x:0 y:0” will never execute.

I try not to remember what the rules are for the order of execution because it’s better to have one green flag that kicks everything off with broadcast statements.

Edit: I wrote a small test case with two sprites that should each do the same thing but one of them has the problem you describe and the other works.
https://scratch.mit.edu/projects/453997387/

Last edited by 10goto10 (Nov. 24, 2020 13:36:59)

enochx
Scratcher
500+ posts

Green flag not working!

Try this.

when green flag clicked
go to x: (0) y: (0)
forever
change y by (-1)
end

when green flag clicked
wait (0.01) secs
forever
if <<[-159] > (y position)> or <[139] > (y position)>> then
set [fail v] to [true]
stop [all v]
end
end

Laurin4space
Scratcher
1 post

Green flag not working!

I have the same problem! But my script is right but my script don’t run if I use the lock if clicked green flag
Can someone help me pls
dave-alt-4
Scratcher
1000+ posts

Green flag not working!

Laurin4space wrote:

I have the same problem! But my script is right but my script don’t run if I use the lock if clicked green flag
Can someone help me pls
pls make your own topic and don't necropost
Frostfairgr10
Scratcher
23 posts

Green flag not working!

My game doesn’t work! I don’t know why but if you press the green flag the whole page freezes! Game link - https://scratch.mit.edu/projects/710833218
scratchtay100
Scratcher
100+ posts

Green flag not working!

Frostfairgr10 wrote:

My game doesn’t work! I don’t know why but if you press the green flag the whole page freezes! Game link - https://scratch.mit.edu/projects/710833218
Please do not necropost (Necroposting is when an archived forum is recovered unnecessarily). Plus, make your own thread on it, please.
ajiscool8
Scratcher
1 post

Green flag not working!

ya i have the same bug. my code is fine but everytime I click on green flag it starts for a split second then stops,I really need an explanation!
Xcvfdd
Scratcher
500+ posts

Green flag not working!

ajiscool8 wrote:

ya i have the same bug. my code is fine but everytime I click on green flag it starts for a split second then stops,I really need an explanation!
Make a separate topic to discuss your issue, this thread is old.
RED-001-alt
Scratcher
1000+ posts

Green flag not working!

Laurin4space wrote:

I have the same problem! But my script is right but my script don’t run if I use the lock if clicked green flag
Can someone help me pls

Frostfairgr10 wrote:

My game doesn’t work! I don’t know why but if you press the green flag the whole page freezes! Game link - https://scratch.mit.edu/projects/710833218

ajiscool8 wrote:

ya i have the same bug. my code is fine but everytime I click on green flag it starts for a split second then stops,I really need an explanation!
3 necroposters

Powered by DjangoBB