Lesson 17: Behaviors in Sprite Lab


Here, students will use Sprite Lab to create their own customized behaviors.


Students will use events to make characters move around the screen, change size, and change colors based on user input. This lesson offers a great introduction to events in programming and even gives a chance to show creativity!


Warm Up (15 min)

Main Activity (30 min)

Wrap Up (15 min)

View on Code Studio


Students will be able to:

  • Identify actions that correlate to input events.
  • Create an animated, interactive game using sequence and events.


  • Play through the puzzles to find any potential problem areas for your class.
  • Make sure every student has a journal.

Introduced Code


Report a Bug

Teaching Guide

Warm Up (15 min)


Today students will revisit sprite behaviors, this time learning how to edit behaviors directly and even make new ones.

Review: Ask students questions about the Swimming Fish and Alien Dance Party lessons.

  • What are some of the behaviors we can assign to our sprites?
  • What do you imagine the code inside a behavior might look like?

Display: Begin by showing Puzzle 1 to your students.

Think/Pair: Ask them to predict what will happen when the code is run, and to discuss with their neighbors. Be sure to open the behavior editor by clicking "edit" on the mystery behavior block. Run the code, and discuss the outcome.

Discuss Ask students questions about how they might change this behavior's code to create a different effect.

  • What would happen if you change the -1 to another number? -5? Positive 1? 0?
  • What other properties might we be able to change about a sprite besides its size?

Main Activity (30 min)

Goal: Today, students will be editing and creating their own behaviors! They’ll begin by making small changes to some familiar but new behaviors and gradually move towards writing their own behaviors from scratch.

Teaching Tip

Encourage students with questions/challenges to start by asking their partner. Unanswered questions can be escalated to a nearby group, who might already know the solution. Have students describe the problem that they’re seeing:

  • What is it supposed to do?
  • What does it do?
  • What does that tell you?

Online Puzzles

Transition: Move students to their machines. Encourage students to follow the instructions for each puzzle. Help them realize that this is a creative activity, intended to help them learn Sprite Lab. It is not an assessment activity of any sort.

Reminder: If puzzles are sharable, remind the students to only share their work with their close friends or family. For more information watch or show the class Pause and Think Online - Video.

Wrap Up (15 min)


Having students write about what they learned, why it’s useful, and how they feel about it can help solidify any knowledge they obtained today and build a review sheet for them to look to in the future.

Journal Prompts:

  • What was today's lesson about?
  • How do you feel about today's lesson?
  • What other behaviors would you like to give your sprites if you knew how?
  • Prediction
  • 1
  • (click tabs to see student view)
View on Code Studio

Student Instructions

Click the "edit" button to see how the mystery behavior works. Study the code inside, then make a prediction.

The sprite will spin

The sprite will shrink.

The sprite will move.

The sprite will change colors.

View on Code Studio

Student Instructions

Fly the rocket to the stars!

  • Change the behavior of the rocket so that it flies upwards in the display area.
View on Code Studio

Student Instructions

Help the rover outrun the robot!

  • Edit the behavior of the rover sprite (top) so that it goes faster than the robot.
View on Code Studio

Student Instructions

Edit the spinning right behavior. The this sprite block should be used instead of the costume block. This will make it work for any sprite, regardless of the costume it uses.

Debug: Make all of the stars spin the same way!

View on Code Studio

Student Instructions

Make a prediction. Which way will the satellite move towards the galaxy?

Left then down


Zig zag

Down, then left

View on Code Studio

Student Instructions

Write your own behavior.

  • Write a new behavior for this astronaut to lead it towards one of the four ships in the display area.
  • Free Play
  • 7
  • (click tabs to see student view)
View on Code Studio

Teaching Tip

This level is a “free play”. These levels have some characteristics you may want to explore before starting.

  • These levels are not checked for correctness to allow for more open-ended creativity. Empower your students to determine for themselves when they have created something they like. There is no one right answer!
  • Example solutions are available for this level which can be viewed by opening the teacher panel to the right.

Student Instructions

Free play: Create your own outer space scene!

View on Code Studio

Student Instructions

Make the ball roll.

  • Create a new behavior and use it to make the ball roll. Your behavior should combine two different actions.

View on Code Studio

Student Instructions

Drive off into the horizon!

  • Create a new behavior and use it to make the car move up (north) and shrink. If you do it right, it could look like it is driving off into the horizon.

Standards Alignment

View full course alignment

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
  • 1B-AP-10 - Create programs that include sequences, events, loops, and conditionals.
  • 1B-AP-12 - Modify, remix or incorporate portions of an existing program into one's own work, to develop something new or add more advanced features.