Lesson 1: Dance Party

Overview

In this lesson, students will program their own interactive dance party. This activity requires sound as the tool was built to respond to music.

Purpose

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

Agenda

Getting Started (5 minutes)

Activity (30-45 minutes)

Wrap Up (5 minutes)

Assessment (2 minutes)

View on Code Studio

Objectives

Students will be able to:

  • Develop programs that respond to timed events
  • Develop programs that respond to user input
  • Create dance animations with code

Preparation

  • Play through the puzzles to find any potential problem areas for your class.
  • Make sure every student has a journal.
  • 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

Vocabulary

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

Support

Report a Bug

Teaching Guide

Getting Started (5 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.

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.

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 be 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 (all ages) to help kick things off. Capture your class's moves on video.

Activity (30-45 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 Spotify Playlist (all ages). If you would like to use the filtered list with older students, you can share this link with your classroom.

Level by Level Support

Level 1

  • 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 2

  • 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 should make the character perform a dance move after the number of measures you indicate.

Level 3

  • 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 4

  • Drag out the set background effect block.
  • This block can be connected inside setup, under an event block, or in both places!

Level 5

  • With the right code, you should see the dancer cycle through a different move every 2 measures.
  • Make sure there is a purple do forever block connected inside the every 2 measures block.
  • Make sure the do forever block is set to either (Next), (Previous), or (Random). Otherwise, the dancer will just perform the set move repeatedly.

Level 6

  • Be careful to avoid putting the red make a new block inside the every 2 measures block. This will cause your program to create multiple identical dancers at the same location.

Level 7

  • Many students will be familiar with the idea that you can make something seem to be further away by drawing it a smaller scale. In this level, you'll create this effect by making the two dancers on the ends smaller.
  • It is important to make sure that the teal set block is placed somewhere in the program after the dancer has been created. To solve this puzzle, place a set backup_dancer2 size to 50 block somewhere under the make a new robot called backup_dancer2 block.

Level 8

  • As with the previous level, make sure to only use the set tint to (color) block after you have the made the dancer in your program. For example, placing it as the first step in the setup area of your program will have no effect.

Level 9

  • Computer science allows to process input information into interesting types of output. In this level, students can explore how a dancer's properties can be updated automatically based on the actual sound of the music.

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 10-11

  • These levels are about making the dance interactive. Try out the new when pressed event to make the dancers respond to key presses.
  • You can use the arrow keys on your computer keyboard or click the orange buttons under the display area.
  • Note that the code students write in these levels is not checked for correctness. This means they will always pass the level, even if they do not change the program. Encourage students to determine for themselves whether the code is doing what they expect before moving on.

Level 12

  • The top six blocks in this tool box look familiar but all work in a different way. Instead of creating or controlling one dancer, they work with groups of dancers.
  • Like the previous levels, code is not checked for correctness here. Students should feel free to experiment with groups in ways that are interesting to them.

Level 13

  • 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!

Wrap Up (5 minutes)

Debrief

  • Pose a prompt that has multiple answers such as “What is something you enjoyed about today's activity?” or “What is the connection between creativity and computer science?"

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.

View on Code Studio

Student Instructions

Let's have a dance party!

Drag the make a new block into the workspace, and connect it inside the setup block to create your first dancer.

  • You can also click the lightbulb to the left if you want more information or extra challenges.
View on Code Studio

Student Instructions

Let's get this moose dancing!

Drag out the new_dancer do floss block onto the workspace. Connect it underneath the after 4 measures event block. Your dancer should start a new move after the fourth measure.

Measures are used to count time in music. In this tutorial, a measure is four beats long.

View on Code Studio

Student Instructions

Now we're grooving!

Add an after 6 measures event block to your workspace. Make the dancer start a new move after 6 measures.

View on Code Studio

Student Instructions

This dance needs some flash!

Look for a new block in your toolbox that adds a background effect behind your dancer. Watch the effects change in time with the music!

View on Code Studio

Student Instructions

Use another new block to make the dancer change moves every 2 measures!

  • Choosing (Next), (Previous), or (Random) tells the dancer to perform a different move every time the code is run.
View on Code Studio

Student Instructions

We need more dancers!

Create a backup dancer called backup_dancer1 to dance with the cat.

View on Code Studio

Student Instructions

Every dancer has a set of properties that control what it looks like.

You can make it look like a dancer is in the background by making their size smaller. Can you make both backup dancers the same size?

View on Code Studio

Student Instructions

Dancers have a "tint" property that can add a layer of color. Try changing the tint of one of your dancers. * Tints will mix the color you choose with the colors of the dancer.

View on Code Studio

Student Instructions

Now we know how to change a dancer's properties. We can also make the same properties automatically respond to the music using this block: right_unicorn begins following bass

This program uses the music's "bass" volume (the low sounds) to control one dancer's height. Can you make the other dancer respond to the music too?

View on Code Studio

Student Instructions

The when up pressed event block lets you run code when the up arrow is pressed.

You might change the dance move, change a dancer's properties, or do a quick move just once. Be creative and look out for new blocks!

View on Code Studio

Student Instructions

It's time for a dance-off! The Cat dabs when you press the left arrow key. Make the Robot "drop" once when you press the right arrow key, and "clap" once when you press the up arrow key.

Use the keys to get the Robot to do the drop-clap-drop-clap as fast as you can!

View on Code Studio

Student Instructions

Check out this block:

Make 6 new ducks in a circle

Now you can create a bunch of dancers at once! Try using some of the "all ducks" blocks to write code that will make all of the ducks dance together.

View on Code Studio

Student Instructions

Get your groove on! Create a dance of your own to share with your friends.