Lesson: Message Driven Programming
Time: 60+ mins
IntroductionWho's ready for a dance party! In this lesson, students will learn the difference between broadcasting a message and sending a message to a specific Actor. Additionally, students will learn how to handle multiple messages between Actors and will change the tempo for the drum beats as they create fun projects that make Actors dance/perform different animations. The last module is a multiple-choice quiz that reviews concepts from this lesson. You can find quiz and module solutions in the "Answer Key" section of this teacher guide.
: Run the code attached to this block when the Play button is clicked. : Run code attached to this block when you press a specified key. : Keep repeating the blocks inside this loop forever. : Repeat blocks inside this loop a specified number of times. : Pause the program for a specific number of seconds. : Broadcast a message to all Actors in the program. : Send a message to an Actor, with the specified parameters. : Listen for a message or broadcast from other scripts before activating. : Play the specified sound file and wait until it is finished playing. : Change the costume of the Actor. : Change the Actor's costume to the specified one.
- Coding: Using a computer language to tell the computer what to do
- Sequence: The order in which steps or events happen
- Actors: Tynker characters and objects that can talk and interact with each other
- Command: A specific action or instruction that tells the computer to do something
- Loop: An action that repeats one or more commands over and over
- Infinite loop: A loop that repeats forever and does not end until the program stops
- Costume: Different appearances for an Actor, such as poses used in a character’s animation
- Animation: Changing costumes (pictures) of an Actor many times to give the illusion of movement
- Tempo: The speed or pace of music, how fast the music plays
- Apply coding concepts to program Actors to do different animations based on the messages they receive.
- Use code blocks to send and receive messages
- Computers, laptops, or mobile devices (1 per student) with student account access to Tynker.com
Warm-Up (15 minutes)Prepare students for today by explaining the difference between the "send message" and "broadcast" code block. Inform them that the "send message" block sends a message to one Actor, whereas the "broadcast" block is used to send a message to all Actors on the Stage. Check for understanding by asking students…
- If you want to send a message to just one Actor, which code block should you use? (Answer: "send message")
- If you want to send a message to all Actors, which code block should you use? (Answer: "broadcast")
Activities (45 minutes)Facilitate as students complete all Message Driven Programming modules on their own:
1. Introduction (Video)
- Students will view a short video that describes how using the "switch to costume" block with the "repeat" block can make an Actor have different animations.
- Students will view an example of a project where the BeatBot throws a punch when the "punch" button is pressed.
- In this DIY (do-it-yourself) project, students will follow step-by-step directions to learn how to program the BeatBot to punch when a button Actor is pressed.
- Activities include programming the button Actor, adding music and sound, and animating the BeatBot, sending messages, and using code to make Actors respond to messages.
- Did students finish early? Direct their attention to the bonus section on the last page of the tutorial which encourages students to add another button Actor that makes the BeatBot run! Note that students are provided the necessary code blocks in this bonus activity.
- To solve this puzzle module, students will need to make the BeatBot perform three different dances!
- Optional: Explain the code attached to the "when I receive jump" block. Tell students that when the message "jump" is received, the BeatBot switches to the next costume in the jump costume series. This is repeated 7 times, and then the costume is switched to "stand" which makes the BeatBot stand still.
- Students will view a sample project where pressing buttons changes the tempo!
- In this DIY project, students will program a drum beat that speeds up and slows down based on the user’s input!
- Students can change the tempo of the beat using messaging.
- Did students finish early? Direct their attention to the bonus section on the last page of the tutorial which encourages students to program a complex beat in the background.
- Students will answer 5 multiple choice questions to review concepts covered in this lesson.
Extended Activities (10 minutes)Discuss the following with students:
- Which activity did you find most challenging?
- How would you describe “coding” to a random student who doesn’t know what it means?
- How did you apply messaging code blocks in today's coding adventure?
- Which code block lets you play music?
- How do you send a message to a specific Actor?
- CCSS-Math: MP.1
- CCSS-ELA: RF.1.1, RF.2.4, RF.2.4.A, RF.3.4.A, RF.4.4.A, RI.2.6
- CSTA: 1B-AP-10, 1B-AP-11, 1B-AP-15
- CS CA: 3-5.AP.12, 3-5.AP.13, 3-5.AP.17
- ISTE: 1.c, 1.d, 4.d, 5.c, 5.d, 6.b
These student-facing slide presentations help educators seamlessly run Tynker lessons in a virtual or physical classroom setting. Each lesson has its own set of slides that introduce the big ideas, suggest unplugged activities, and include a section for each activity module. While running lesson slides, you can switch back and forth between the activity, the slides, answer keys and other lesson materials.
A sample slide presentation is available for your review. Please log in to view all the class presentations available with your plan..
Loops and Animation
Creating a Scene
Jumping over Obstacles
Music and Animation
Instruments and Tempo
Message Driven Programming
Pop the Balloon
Animation with Movement