Programming 301 Lesson Plan

Lesson: Conditional Loops
Time: 60+ mins

Introduction

In this lesson, students will learn how to specify an Actor’s costume and learn about the “forever-if” loop. Students will also create a project that uses function blocks. Coding concepts covered in this lesson include: Next Costume and Forever If.

New Code Blocks

  • : Change the Actor’s costume to the specified one.
  • : Run the code inside this block as long as the condition is true.
  • : Move the knight to the right.
  • : Move the knight to the left.
  • : Move the knight up.
  • : Move the knight down.

Vocabulary

  • Function: A sequence of commands that can be run together as if it were a single command

Objectives

Students will...
  • Use conditional loops to animate Actors
  • Use code blocks to solve a puzzle module

Materials

  • Computers, laptops, or mobile devices (1 per student) with student account access to Tynker.com

Warm-Up (15 minutes)

  • Remind students how animation is created (e.g., series of still images). Next, ask them to give examples of how they’ve animated Actors using Tynker. (e.g., Use the “next costume” code block to make a character look like it’s moving.)
  • Optional: Use your projector to display Tynker animation examples: https://www.tynker.com/programming-for-kids/explore/projects.html and explain to your students that in this lesson, they’ll create animations using conditional loops!

Activities (45 minutes)

Facilitate as students complete all Conditional Loops modules on their own:
1. Concepts (Video)
  • Bert, the wizard, introduces two coding concepts:
    • Next Costume- Students will learn about the “next costume” and “switch to costume” code blocks by watching an interactive introduction. Students will also interact with different code blocks to see Codey switch into different costumes and play different animations!
    • Forever If- Students are introduced to the “forever if” code block through an interactive presentation with examples.
2. Looping Knight Moves (DIY)
  • In this DIY (do-it-yourself) project, students will follow step-by-step directions to program a knight to move around using loops and conditionals.
  • Check that students are changing the values in the “key left arrow pressed?” conditions and the “point in direction” code blocks.
3. Knight Attack Functions (DIY)
  • In this DIY project, students will program a knight to walk around and attack using special function blocks.
  • Point out to students that the point of functions is to make it easier to do complex things without moving lots of code blocks around.
  • Remind students to press the spacebar (web) or tap the screen (mobile) to make the knight attack.
4. Zombie Survival (Puzzle)
  • To solve this puzzle module, students will need to program the knight to chase and defeat all the zombies.
  • Give a hint: Tell students to attach a “switch to costume” code block to the “attack” code block. Next, ask students what costume they should select in the “switch to costume” block. (Answer: “Attack 1”)
5. Animation Control (DIY)
  • In this DIY project, students will practice animating Actors using keyboard events (web) or tilt controls (mobile).
  • Explain to your students that experimenting with their code will allow them to better understand how the code blocks work.
6. Quiz (Multiple-choice)
  • Students will answer multiple-choice questions to review concepts from this lesson.

Extended Activities (10 minutes)

Ask your students...
  • What are some code blocks we used to animate Actors? (Answer: “next costume” and “switch to costume”)
  • What is repetition? What is another name for it? (loop)
  • How would you describe “animation” to a student who doesn’t know what it means?
  • True or false: A “forever if” loop is an example of a conditional loop. (Answer: True)
  • If we want to use a counting loop, should we use a “forever” block or a “repeat” block? (Answer: “repeat” block)
  • Who can give an example of a conditional statement? (Example: If it is raining outside, then I will wear rain boots.)

U.S. Standards

  • CCSS-Math: MP.1
  • CCSS-ELA: RI.7.4, RI.8.4, 6-8.RST.3, 6-8.RST.4, 6-8.RST.7
  • CSTA: 2-AP-10, 2-AP-13, 2-AP-16, 2-AP-17
  • CS CA: 6-8.AP.10, 6-8.AP.13, 6-8.AP.17
  • ISTE: 1.c, 1.d, 4.d, 5.c, 5.d, 6.b

U.k. Standards

Key Stage 3 (Years 7-9)
  • Understand several key algorithms that reflect computational thinking [for example, ones for sorting and searching]; use logical reasoning to compare the utility of alternative algorithms for the same problem.
  • Create, re-use, revise and re-purpose digital artefacts for a given audience, with attention to trustworthiness, design and usability.
  • Understand a range of ways to use technology safely, respectfully, responsibly and securely, including protecting their online identity and privacy; recognise inappropriate content, contact and conduct and know how to report concerns.
This course is not part of your plan. Please upgrade to view all answer keys

Class Presentations

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..
Lesson 1
Introduction
27 Slides
Lesson 2
Animated Motion
20 Slides
Lesson 3
Actor Positioning
19 Slides
Lesson 4
Motion and Tracking
18 Slides
Lesson 5
Conditional Loops
23 Slides
Lesson 6
Show and Hide
20 Slides
Lesson 7
Actor Properties
18 Slides
Lesson 8
Nested Loops
18 Slides
Lesson 9
Messaging
21 Slides
Lesson 10
Start Screen and Controls
21 Slides
Lesson 11
Shoot Projectiles
21 Slides
Lesson 12
Parallax Scrolling
18 Slides
Lesson 13
Cloning
19 Slides
Lesson 14
Variables
20 Slides
Lesson 15
Powerups and Effects
20 Slides
Lesson 16
Boss Battle
18 Slides
Lesson 17
Finishing Touch
15 Slides