Lesson 7: 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

For the Students

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 2

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

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

  • 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 a smaller scale. In the next level you’ll be able to fine tune this effect.

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.

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

Level 15

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

  • Warm Up
  • 1
  • (click tabs to see student view)
  • Practice
  • 2
  • (click tabs to see student view)
View on Code Studio

Student Instructions

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

Choose cat or sloth to create your first dancer.

  • You can also click the lightbulb to the left if you want more information or extra challenges.
  • Events
  • 3
  • 4
  • 5
  • (click tabs to see student view)
View on Code Studio

Student Instructions

The when up pressed block lets you run code when you press the arrow buttons. Use the do once block to make the cat clap!

Make sure to press your "up arrow" key or after clicking the Run button!

View on Code Studio

Student Instructions

It's time for a dance-off! Program each dancer to move when you press different keys. Choose your favorite move for each dancer or set it to (Random) for something totally unpredictable!

View on Code Studio

Student Instructions

Let's get the dancers moving in time with the music!

Connect the 4"measures" block to a "SHARK"MOVES.ThisOrThat-1 block from the toolbox.

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 6"measures" block to your workspace. Make the dancer start a new move after 6 measures.

View on Code Studio

Student Instructions

Use this new block to set up a group of smaller backup dancers around a lead dancer in the middle.

??? ??? "circle"

Now you can create a bunch of backup dancers all at once!

View on Code Studio

Student Instructions

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

Use the set block under a green event block to make dancers appear closer or farther away.

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 (or an entire group)!

View on Code Studio

Student Instructions

This new block is a special kind of event that is triggered over and over.

2"measures"

By placing the other new blocks in your toolbox inside the repeat block you can repeatedly change dancers' properties over time. Be creative and have fun!

When you are done press the Finish button.

  • Wrap-up
  • 14
  • (click tabs to see student view)
  • Free Play
  • 15
  • (click tabs to see student view)
View on Code Studio

Student Instructions

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

View on Code Studio

Student Instructions

Back and Forth!

Sometimes you might want to create a pattern of dance moves you choose. This new block lets you do just that.

sprites2MOVES.RollMOVES.ClapHigh

The moves you choose above will repeat in sequence forever.

  • Create an alternating routine for the lead dancer at the front!
  • Use different numbers to change the rate at which the moves alternate. Try 1 or 0.5 to alternate more quickly!
View on Code Studio

Student Instructions

Let's Get in Formation!

Check out this dance that uses the layout block to change the backup dancers' formation throughout the dance. Try one of these ideas to extend it:

  • Create a second group of dancers in a different layout
  • Change layout when a key is pressed
  • Change a property when the dancers change formation

Standards Alignment

View full course alignment

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
  • 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.