Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make it so if 3 sprites all make it to the finish line something happens.
- softballandme
-
17 posts
How to make it so if 3 sprites all make it to the finish line something happens.
Hello. I'm not quite sure how to make it so if 3 sprites all make it to the finish line something happens. Is it something like this?
when green flag clicked
if < What here?> then
broadcast [ Whatever ]
end
say [sprites need homes help]
- MrKingofScratch
-
100+ posts
How to make it so if 3 sprites all make it to the finish line something happens.
It would help a lot if you shared your project.
here's an idea:
you can use a variable to store the amount of sprites that cross the finish line.
when the game starts, we have to reset the variable to 0. This can be in any sprite.
then, we can make it so that the sprites increase the value when they cross the finish line. Put this script in every sprite that can cross the finish line.
Finally, we have to detect when 3 sprites reach the finish. We can update the first script to do so.
This will detect when 3 racers have crossed the line, and broadcast your message.
Let me know if it works!
here's an idea:
you can use a variable to store the amount of sprites that cross the finish line.
when the game starts, we have to reset the variable to 0. This can be in any sprite.
when green flag clicked
set [#ofFinishers v] to [0]
then, we can make it so that the sprites increase the value when they cross the finish line. Put this script in every sprite that can cross the finish line.
when green flag clicked
wait until <touching [Finish line v] ?>
change [#ofFinishers v] by (1)
Finally, we have to detect when 3 sprites reach the finish. We can update the first script to do so.
when green flag clicked
set [#ofFinishers v] to [0]
wait until <(#ofFinishers) = [3]>
broadcast [whatever v]
This will detect when 3 racers have crossed the line, and broadcast your message.
Let me know if it works!
- Yoshi__CP
-
2 posts
How to make it so if 3 sprites all make it to the finish line something happens.
Dose anyone know how to make a person a manger on a scratch studio
- MrKingofScratch
-
100+ posts
How to make it so if 3 sprites all make it to the finish line something happens.
In the future, you should make your own forum post for that by hitting the “new topic” button at the top of the forums. To answer your question, in the studio click on “curators”, then click the 3 dots next to the person you want to promote, then click promote. Dose anyone know how to make a person a manger on a scratch studio
- softballandme
-
17 posts
How to make it so if 3 sprites all make it to the finish line something happens.
But the thing is There are 3 cars going in different directions so there are basically 3 finish lines… I should've mentioned that before.
Would your code still work for my problem?
Would your code still work for my problem?
- Bennguin
-
3 posts
How to make it so if 3 sprites all make it to the finish line something happens.
Is the project shared?
Last edited by Bennguin (Aug. 19, 2024 01:08:00)
- softballandme
-
17 posts
How to make it so if 3 sprites all make it to the finish line something happens.
No I didn't finish… But we're going of subject could you please explain how to make it so if 3 sprites all make it to the finish line something happens
Last edited by softballandme (Aug. 19, 2024 01:10:50)
- MrKingofScratch
-
100+ posts
How to make it so if 3 sprites all make it to the finish line something happens.
just make sure that the But the thing is There are 3 cars going in different directions so there are basically 3 finish lines… I should've mentioned that before.
Would your code still work for my problem?
<touching [ v] ?>block is set to the correct finish line for each sprite. Then it should work!
If it doesn't, please share the project even if it isn't finished because that makes it a lot easier to figure out what the problem is.
- softballandme
-
17 posts
How to make it so if 3 sprites all make it to the finish line something happens.
Alright thanks
- Discussion Forums
- » Help with Scripts
-
» How to make it so if 3 sprites all make it to the finish line something happens.