Discuss Scratch

KonoDio_Da
Scratcher
6 posts

What do the "broadcast" blocks do?

I've tried to go into projects and study them, but I just can't figure out what they do! I feel like they would help a lot when I make a project. If you could please help me out, that would mean a lot.



when I receive [ what does this do?]

broadcast [ what does this do?]

broadcast [ what does this do?] and wait
deck26
Scratcher
1000+ posts

What do the "broadcast" blocks do?

A broadcast is a way for one script to start other scripts running. For example, if a bat hits a ball the bat may detect the touch and send a message to the ball to get it to change direction. In a two player game this might also tell the other player that the ball is now coming towards them and it's their turn to hit it.

At the end of a game a ‘game over’ broadcast could be used to stop scripts in all the sprites.
deck26
Scratcher
1000+ posts

What do the "broadcast" blocks do?

And broadcast and wait just means the script that sends the message will wait until all the receiving scripts have finished running. If you don't use the wait option the script will contine without waiting.

Last edited by deck26 (Jan. 14, 2021 15:39:19)

BIGBABUL
Scratcher
6 posts

What do the "broadcast" blocks do?

when green flag clicked
broadcast [ v]

SO THIS CODE MAKES A SIGNAL SO WHIN I WEITE

when I receive [ v]
play sound [ v] until done

SO WITH THIS YOU CAN SEND SIGNAL TO 1 SPRITE TO 2 OR 1 BACKDROP TO ANOTHER
KonoDio_Da
Scratcher
6 posts

What do the "broadcast" blocks do?

So what I understand from what you told me, is this as an example:

Sprite 1:
when green flag clicked
wait (10) secs
broadcast [ Move 10 up]

Sprite 2:
when I receive [ Move 10 up]
change x by (10)
deck26
Scratcher
1000+ posts

What do the "broadcast" blocks do?

KonoDio_Da wrote:

So what I understand from what you told me, is this as an example:

Sprite 1:
when green flag clicked
wait (10) secs
broadcast [ Move 10 up]

Sprite 2:
when I receive [ Move 10 up]
change x by (10)
That sort of thing is an example although changing x moves right, not up!
walkontheplushyside
Scratcher
84 posts

What do the "broadcast" blocks do?

broadcast [ message]

The broadcast block is meant to be used to send messages out to other sprites or the one that you are currently in

Last edited by walkontheplushyside (Jan. 14, 2021 19:36:31)

Powered by DjangoBB