During my computer training sessions, teachers and students asked me a few times how to create a dialogue between two characters in Scratch.
It’s not quite as easy as I first thought it was, and I thought I’d create a quick guide to go through it.
There are several ways that multiple characters can have a conversation in Scratch. You use a broadcast block and you use variables to trigger every line of the conversation. I’ll cover both methods here and you can see which one you prefer.
First plan the desired dialog.
Give each dialog line a number. A 5-step conversation between a cat and a dog could look like this, for example:
Then open Scratch, click the Add Sprite button, and add a dog sprite to the stage:
Use the broadcast method.
The broadcast method is not always the most efficient way to get sprites to communicate a lot of messages. With broadcasts, however, short conversations can easily be made. After each sprite conversation, a message is sent to inform the other sprite that it is your turn to speak. Check out this project on scratch here.
Enter this code in the field cat Sprite (click on the cat to add code).
Enter this code in the field dog Sprite (click on the dog to add code to it)
Use the variable method
The variable method uses one variable to trigger the other sprite to speak. After a sprite has finished speaking, it changes a variable by “1”, in which the other sprite recognizes and then starts speaking. See this here on scratch.
Click on variables, and “Make a variable”
Choose “For all sprites”. Call this variable “speaker”
Set up the following code in the Cat.
Set up the following code in the dog.
If you want it, You can download this manual as a worksheet.
This can be a good activity in English or MFL to script a conversation between characters and then do it in Scratch. You could write an imaginary conversation with a famous scientist explaining your discoveries.
Hope that helps!
Note: We are not the author of this content. For the Authentic and complete version,
Check its Original Source