Lesson: Keyboard Interaction
Time: 60+ mins
IntroductionIn this lesson, students will program input controls to move Actors.
: Run code attached to this block when you press a specified key. : Change the x-coordinate of an Actor by the specified number of pixels.
- Use keyboard (web) or tilt controls (mobile) to move characters
- Create unique controls to move Actors
- Computers, laptops, or mobile devices (1 per student) with student account access to Tynker.com
Warm-Up (15 minutes)Review the following terms with your students. They will use these in today’s lesson:
- Horizontal axis (x-axis): The line on a graph or coordinate plane that runs horizontally (left-right)
- Vertical axis (y-axis): The line on a graph or coordinate plane that runs vertically (up-down)
- x-value: Horizontal (left-right) value along a coordinate plane
- y-value: Vertical (up-down) value along a coordinate plane
- Have we seen these terms before? (Yes, in the "Jumping Over Obstacles" lesson)
- Who remembers which code block we used to make the Actor move in the up-down direction? ("change y by" block)
- Does the "x-value" move in the left-right or up-down direction? (left-right)
- If we wanted to make an Actor move left or right, would we use a "change x by" block or a "change y by" block? ("change x by" block)
Activities (45 minutes)Facilitate as students complete all Keyboard Interaction modules on their own:
1. Move to Collect Power Cells (Video)
- Students will watch a short video that introduces the upcoming programming activity.
- Optional: Read the captions on the screen to your students.
- Students will view an interactive project of Gus moving, which they will create their own version of in the next module!
- Tell students to use their left and right arrow keys (web) or tilt their screen left and right (mobile) to move Gus.
- Tell students to click the red button to move on to the next module.
- In this DIY (do-it-yourself) project, students will program Gus to respond to keyboard (web) or tilt (mobile) commands!
- Tell students that the "change x by" block uses both positive and negative values to make Gus move horizontally (left-right).
- Check that students understand that the background doesn’t shift Gus to the left--his code moves him independently of other Actors (i.e., the Stage).
- To solve this puzzle module, students will need to program Gus to move back and forth to catch power cells!
- Give a hint: Tell students to use a negative 10 value inside one of the "change x by" blocks to make Gus move backwards (to the left).
- Students will view a project where the alien moves when arrow keys (web) or tilt controls (mobile) are used.
- In this DIY project, students will program an Actor to move up, down, left, and right using keyboard (web) or tilt (mobile) controls!
- Remind students that the "change y by" block moves the Actor up and down, depending on the value inside the block. For example, a "-10" will move the Actor down, whereas a "10" will move the Actor up.
- Students will answer 5 multiple choice questions to review concepts covered in this lesson.
Extended Activities (20 minutes)Lead a mini-discussion with your students:
- Who can list the four directions we programmed the Actors to move? (Up, right, down, left)
- True or false: The "change x by" block moves the Actor up or down. (False)
- How is the "change x by" block different from the "change y by" block? (The "change x by" block moves the character horizontally, whereas the "change y by" block moves the character vertically)
- What is something you struggled with in today’s lesson? How did you troubleshoot the problem?
- What is something you enjoyed about today’s lesson?
- 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