[go: up one dir, main page]

100% found this document useful (1 vote)
2K views18 pages

How Sprites Interact in Scratch

Here are the key points about broadcasting in Scratch: - Broadcasting allows sprites to communicate with each other by sending and receiving messages. - The "broadcast" block is used to send a message from one sprite, while the "when I receive" block allows other sprites to run scripts in response to receiving that message. - Broadcasting is useful for coordinating the timing of events between sprites, like starting/stopping a game, making multiple sprites react at once, or simulating a conversation between characters. - Common uses of broadcasting include controlling gameplay, producing simultaneous actions, holding conversations between sprites, and responding to different events in a scene. - Proper use of broadcasting requires planning which sprite will send the message

Uploaded by

Ravi Shastry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
2K views18 pages

How Sprites Interact in Scratch

Here are the key points about broadcasting in Scratch: - Broadcasting allows sprites to communicate with each other by sending and receiving messages. - The "broadcast" block is used to send a message from one sprite, while the "when I receive" block allows other sprites to run scripts in response to receiving that message. - Broadcasting is useful for coordinating the timing of events between sprites, like starting/stopping a game, making multiple sprites react at once, or simulating a conversation between characters. - Common uses of broadcasting include controlling gameplay, producing simultaneous actions, holding conversations between sprites, and responding to different events in a scene. - Proper use of broadcasting requires planning which sprite will send the message

Uploaded by

Ravi Shastry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

How Sprites

Interact In
Scratch
By the end of this class…

•You are going to learn how to communication occurs


between sprites.

•What is Broadcasting

•In what ways it can be used in Scratch


Starter

Log onto your Find the program


Load it up.
computer. called Scratch.
Objective
How to Broadcast a Message in Scratch

•Learn how to create a dialogue between two or more sprites

•How to create a Broadcast Message

•Different uses of Broadcasting


What are broadcasts in Scratch?
•You can't make one sprite move another sprite

•But you can make one sprite tell another one it's
time to do something, and then that sprite can
move itself

•To do that, you send a message using a broadcast

•Broadcasts are messages that one sprite sends to


another
Scratch Coding Blocks to Broadcast a Message

Send a message to sprites


Send a message to sprites. Pause until all
scripts triggered by the message have finished
running.
Run a script when a broadcasted message is
received.
Broadcasting controls WHEN
something happens – it is all about
When Should TIMING!

You Broadcast a
Message in Instructions are sequenced using

Scratch? coding blocks in Scratch.


Broadcasting blocks are used to
set the timing of events in an
animated scene, game, or story.
What can you do with broadcasting?

Hold a Conversation:
Have sprites chat with one another in an animated scene or story.
Broadcasting can prompt a character to answer a question. Or,
cause a character to respond to something that was said.

Respond to Events:
Use broadcasting to make a sprite react to an event. For example,
a character may move or change appearance when something happens.
What can you do with broadcasting?
Continued...

Produce Multiple Actions at Control Game Play: End a Game:


the Same Time:
Direct when a game Set what happens when a game is
Broadcasting can send a
over. Use broadcasting to inform a
message to many sprites. begins using
player that the game has ended.
This can cause several broadcasting. After the For instance, you could display a
characters to do instructions appear on the message, such as GAME OVER.
something at the same screen a broadcasted Broadcasting can also be used to
message can launch the stop game play. For example, you
time. This enhances could hide targets to prevent the
game. Use it to make
storytelling and holds player from scoring more points.
targets appear or start a
viewer interest.
timer.
•When using broadcasting it is a good idea to PLAN
AHEAD

•Decide what you want to happen

•Once you have an idea, pick the sprite that will send the
Plan to message. Who is in control of when an action happens?

Broadcast a •Study the sprite’s script. To send the message at the right

Message in time, where should the broadcast coding block be


placed?

Scratch •Next, pick the sprite or sprites that will receive the
message. What will they do when they receive the
message?
How to Broadcast a
Message in Scratch
3. Click the arrow. Select New message
1. Select the sprite that will send a
message.
2. From the Events palette, add the
block broadcast message1.

4. To make it easy to identify, give a


broadcast message the name of the
action it will trigger.
Continued...

How to Broadcast a
Message in Scratch 5. Place the broadcast block where you
want to send the message.

6. Select the sprite that will receive the


message.

7. From the Events palette, add the


block when I receive message1. Click
the arrow. Select the message name
from Step 4.

8. Build a script that has the sprite do


an action.
A simple demonstration of broadcasts

1. Start a new project.


2. In Scratch , import the sprite Bat.
3. Add this script to the cat sprite
4. Add this script to the bat.
5. Run the program. When you click
the cat, it sends an invisible
message to the bat, the bat receives
the message and flaps its wings and
flies.
6.

What else should I know about broadcasts?


1. Broadcasts are sent to all sprites at
the same time, but they don't all
have to respond
2. You can react to a broadcast from
the same sprite that sent it.
3. So you need to take care that you
put your 'reaction' scripts on the
right sprite and don't do this by
mistake
Time To Experiment

1. Investigate
broadcasting blocking
using an example of
your own.
2. Try using broadcasting
in a game of your own.
Time To Reflect
1. How else can you
imagine broadcasting
being used?
2. How would you explain
broadcasting to someone
else?
3. What are you still
wondering about
broadcasting?
How to use broadcasting to direct the timing of the
events.
How communication can occur between sprites.
Lesson How can you create a dialogue between sprites.
How to change a backdrop using broadcasting
Outcomes
events.
How to trigger the start and end of the game using
Broadcasting.
How much do you remember?

1. What is Broadcasting?
2. What blocks are used in broadcasting?
3. Where can it be used?
4. Which button can you use to add a sprite to the
stage?
5. How can you change the folder you are looking at?

You might also like