Today, we are diving into a more advanced concept in ScratchJr: creating a conversation between two characters using message blocks. This requires understanding the Send Message block and the Start on Message block—a fundamental programming concept for creating dialogue and coordinating events.
Our project today demonstrates this concept by programming Kitten and Penguin on a playdate to greet each other in a sequential conversation.
Setting the Scene and Characters
We need a simple background and our two conversational characters.
- Change the Background: Select a simple background, such as the empty room. [00:20]
- Add Characters: Add the Penguin character to the project. [00:33]
- Position Characters: Place Kitten and Penguin on opposite sides of the screen.
Script 1: Penguin (The Initiator)
Penguin is the first character to speak, so their script must start the conversation chain. Ensure the Penguin icon is selected.
- The Trigger: Begin the script with the Green Flag trigger block (yellow category). [00:48]
- The Dialogue: Go to the purple Looks category and add the Say block. Click the text box and write the Penguin’s greeting, such as, “Hello! How are you?” [01:26]
- The Signal: Go back to the yellow category and add the Send Message block (the yellow envelope). This block immediately sends a signal to the other characters. This signal is what tells Kitten it’s their turn to speak. [01:04]
- End: Finish the script with the red End block. [01:14]
Script 2: Kitten (The Responder)
Kitten must wait for the signal from Penguin before speaking, making their script different from the usual Green Flag start. Ensure the Kitten icon is selected.
- The Message Trigger: Go to the yellow category and select the Start on Message block (the green envelope). This block only activates when it receives the signal sent by the Penguin’s script. [01:51]
- The Dialogue: Go to the purple Looks category and add the Say block. Click the text box and write Kitten’s response, such as, “I am great, thanks for asking!” [02:18]
- End: Finish the script with the red End block. [02:07]
Running the Conversation Sequence
When you press the Green Flag, the following sequence occurs:
- Penguin’s script starts.
- Penguin says, “Hello! How are you?” [02:29]
- The Send Message block is triggered.
- Kitten receives the message via the Start on Message block.
- Kitten responds with, “I am great, thanks for asking!” [03:06]
This sequence ensures the conversation happens in order and demonstrates a fundamental coding concept: one character’s action can trigger another character’s event.
Mastering the use of message blocks is a major step in our coding tutorials for teaching children event-driven programming. For structured lesson plans, explore our collection of ready-made lessons. Happy coding!