< Course D (2022)

Lesson 8: Dance Party

45 minutes

Overview

In this skill-building lesson, students will program an interactive dance party.

Purpose

This lesson introduces the core CS concepts of coding and event programming (using blocks).

CSTA K-12 Computer Science Standards (2017)
    • 1B-AP-09 - Create programs that use variables to store and modify data.
    • 1B-AP-10 - Create programs that include sequences, events, loops, and conditionals.

Agenda

Objectives

Students will be able to:
  • Create dance animations with code
  • Develop programs that respond to timed events
  • Develop programs that respond to user input

Preparation

  • Play through the puzzles to find any potential problem areas for your class.
  • Consider the need for headphones. This activity relies on sound.

Links

Heads Up! Please make a copy of any documents you plan to share with students.

For the teachers
For the students

Vocabulary

  • Event - An action that causes something to happen.
  • Program - An algorithm that has been coded into something that can be run by a machine.
  • code - (v) to write code, or to write instructions for a computer.

Teaching Guide

Getting Started (10 minutes)

Setting the Stage

Welcome students to class and very briefly introduce the day’s activity.

Teaching Tip

If you have time and would like to prepare your students with an unplugged activity, consider delivering *Dance Party: Unplugged before this lesson. This brief lesson introduces students to the idea of events triggering different dance moves.

Reflect

Display: Show “Reflect” slide

Remarks

Today we're going to do something really creative. What's your favorite way to be creative?

Encourage students to share the ways they express creativity, such as with art, dance, music, writing.

Vocabulary

Display: Show “Vocabulary” slide

  • Event - An action that causes something to happen.
  • Program - An algorithm that has been coded into something that can be run by a machine.
  • Code - (v) to write code, or to write instructions for a computer.

Introduction

Explain that today we're going to be creative with our code. Just like choosing which type of colors of paint to use, or what kinds of words you write with can express creativity, choosing what code you write and how people interact with it can be an opportunity to express your creativity too!

Get up and dance: Announce to the class that today we're going to see how we can combine coding with dancing in a creative way. Ask your kids to floss, dab, or do a creative dance move of their own for 10 seconds to get them in the mood. You can play a song from this *Spotify Playlist to help kick things off. Capture your class's moves on video.

Activity (30 minutes)

Code Your Own Dance Party

Music Filtering

This tutorial features songs from popular artists. To get a preview of the song list in this tutorial, check out this *Spotify Playlist. We are using radio-safe versions of all songs and for students under 13, we limit the music to this filtered list. If you would like to use the filtered list with older students, you can share *Spotify Playlist with your classroom.

Level by Level Support

Level 1

Display: Show “Dance Party Warm Up” video

Level 2

Display: Show “Level 2 - Practice” slide

  • Drag the red make a new block from the toolbox on the left to the workspace on the right. Connect it inside the setup block.
  • You have now written your first program. Make sure to press Run to see what happens. You should hear music and see a character start to move in the display area.

Level 3

Display: Show “Dance Party Events” video Level 3

Level 4

Display: Show “Level 4-5 - Events” slide

  • Levels 4-5 are about making the dance interactive.
  • The green blocks are event blocks. These blocks start a new sequence of code and do not need to be connected inside the setup block.
  • Connecting the purple block under the green event block allows you to make the character perform a dance by pressing the orange arrow buttons or keys on your keyboard.
  • Make sure to press the arrow buttons after pressing Run or the dancer(s) won’t move.
Level 5
  • Make sure to bring out a second purple do once block. You should have a bears do once block and a cats do once block in your workspace. Both should be connected to a green when pressed event block.
  • Make sure to press the arrow buttons after pressing Run or the dancers won’t move.

Level 6

Display: Show “Dance Party Measures” video

Level 7

  Display: Show “Level 7-9 - Measures” slide

  • Levels 7-8 are about synchronizing the dance to the music.
  • The after measures event blocks also start a new sequence of code and should not be connected inside the setup block.
  • Connecting the purple do forever block under the green after measures event block should make the character perform a dance move after the number of measures you indicate.
  • The do forever block works differently from the do once blocks seen in the previous levels.
Level 8
  • Make sure to bring out a second green event block. You should have a after 4 measures block and a after 6 measures block in your workspace. Both should have purple block connected underneath.
Level 9
  • Level 9 is about creating groups of dancers quickly.
  • Use the new block provided into the toolbox to create a set of smaller dancers. *You should also use the normal make a new block to create a larger “lead” dancer.
  • Many students will be familiar with the idea that you can make something seem to be further away by drawing it on a smaller scale. In the next level you’ll be able to fine tune this effect.

Level 10

Display: Show “Dance Party Properties” video

 

Display: Show “Level 11-13 - Properties” slide

Level 11
  • Levels 11-13 are about adjusting the properties (e.g. size, color) of the dancers.
  • It is important to make sure that the teal set block is placed somewhere in the program after the dancers have been created. To solve this puzzle, place a set size block anywhere in your program and use it to change the size of some of your dancers.
  • Dancers created as a group have a default size of 30. Other dancers have a default size of 100.
Level 12
  • As with the previous level, make sure to only use the set tint to (color) block after you have made the dancers in your program. For example, placing it as the first step in the setup area of your program will have no effect.
Level 13
  • With the right code, you should see the dancer cycle through different colors, sizes, or dance moves.
  • Make sure there is a teal change, a teal randomize block, or a purple do forever block connected inside the every 2 measures block.
  • Make sure do forever blocks are set to either (Next), (Previous), or (Random). Otherwise, the dancer will just perform the set move repeatedly.
  • Note that the code students write in this level is not checked for correctness. This means they will always pass the level, even if they do not change the program. Students should feel free to experiment with their code in ways that are interesting to them. Click the “Finish” button to move on.
  • Making new dancers inside the every 2 measures block will cause your program to create multiple identical dancers at the same location(s) and may lead to unintended consequences!

Teaching Tip

By this point in the lesson you may notice that the instructions are less prescriptive. Encourage students to be creative and explore the new blocks that are introduced. From this point on student code is not checked for correctness in order to encourage experimentation instead of solving a specific task.

Level 14

Display: Show “Dance Party Party On!” video

Level 15

Display: Show “Level 15 - Free Play” slide

  • This last level is very open-ended. The tutorial itself is designed to give students ample time to keep working on their own dance.
  • Encourage Sharing: If students have cell phones with a data plan they can quickly text a link to their projects to their own phone or a friend's. If your school policy allows it, encourage them to do so here.
  • Encourage Creativity: Creativity is important throughout this lesson, but this is true here more than anywhere else!

 

Lesson Extras

Display: Show “Lesson Extras” slide

Wrap Up (5 minutes)

Reflection (5 minutes)

Display: Show “Reflect” slide

Reflect: How does being creative help you program?

Optional Assessment (2 minutes)

Ask students to add their “Whip Around” sticky notes or note cards to your "Computer Science" mind map on their way out the door. Try to populate the board with lots of great ideas about what CS is and why it matters.

Cross-Curricular Opportunity

Survival of the Dancers (45-60 minutes)

Computer Science + Science

Survival of the Dancers is an optional activity aligned to Next Generation Science Standards, written by our teacher community. Using Dance Party, students will select at least one organism (dancer) which is well suited for the environment (world) they create. Students are encouraged to utilize the “properties” blocks of code to customize the characteristics of each organism (dancer).

Standards Addressed:

  • NGSS.3-LS4-2: Use evidence to construct an explanation for how the variations in characteristics among individuals of the same species may provide advantages in surviving, finding mates, and reproducing.

  • NGSS.3-LS4-3: Construct an argument with evidence that in a particular habitat some organisms can survive well, some survive less well, and some cannot survive at all.

  • OPTIONAL EXTENSION: NGSS.3-LS4-4: Make a claim about the merit of a solution to a problem caused when the environment changes and the types of plants and animals that live there may change.

Creative Commons License (CC BY-NC-SA 4.0).

This work is available under a Creative Commons License (CC BY-NC-SA 4.0).

If you are interested in licensing Code.org materials for commercial purposes contact us.