Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » What is broadcasting?
- chameleoncool
-
Scratcher
57 posts
What is broadcasting?
broadcast [ v]What is broadcasting? And what happens when you do it? I see that many scratchers use this block in their projects but I am never able to understand how to use the block and what it does.
- deck26
-
Scratcher
1000+ posts
What is broadcasting?
It allows one script/event to trigger additional scripts to work.
So a sprite hitting the edge of the screen could broadcast so the Stage gets a message to switch backdrop. A scoring function could broadcast when a certain score is reached to get multiple sprites to do things. For example, switching to the next level may mean sprites appear/hide, backdrops change and so on.
So a sprite hitting the edge of the screen could broadcast so the Stage gets a message to switch backdrop. A scoring function could broadcast when a certain score is reached to get multiple sprites to do things. For example, switching to the next level may mean sprites appear/hide, backdrops change and so on.
- chameleoncool
-
Scratcher
57 posts
What is broadcasting?
Thanks for the explanation! But how would I know what the message does? And what does creating a new message do?
- -Opinion-
-
Scratcher
4 posts
What is broadcasting?
Try using it (because I don't really know how to explain it
)
Just take out two sprites.
Sprite one:
Sprite two:
This block basically makes two sprites communicate with each other and tell each other to do something.
)Just take out two sprites.
Sprite one:
when green flag clicked
say [Hello!] for (2) secs
say [What is your name?] for (2) secs
broadcast [Your name]
Sprite two:
when I receive [Your name]
say [My name is (blah)] for (2) secs
This block basically makes two sprites communicate with each other and tell each other to do something.
Last edited by -Opinion- (May 19, 2020 10:03:35)
- deck26
-
Scratcher
1000+ posts
What is broadcasting?
You need to distinguish between messages so you give them names.
broadcast [next level v]or whatever. Creating a new message does nothing untiil you write at least one receiver and tell the project to make the broadcast.
broadcast [player1-turn v] and wait // don't continue this script until all receiver scripts complte
when I receive [player1-turn v]
code goes her for player 1 to take a turn
Last edited by deck26 (May 19, 2020 10:06:13)
- Catman9654
-
Scratcher
100+ posts
What is broadcasting?
It brodcasts a message across the workspace. Like this:
when green flag clicked
broadcast [Cool v]
when I receive [Cool v]
move (10) steps
- Locomule
-
Scratcher
1000+ posts
What is broadcasting?
Check out the Scratch Wiki, tons of great nfo in there
- Discussion Forums
- » Help with Scripts
-
» What is broadcasting?
