< Course F (2024)

Lesson 5: Mini-Project: Virtual Pet

60 minutes

Overview

Students will create an interactive Virtual Pet that looks and behaves how they wish in this mini-project lesson. Students will use Sprite Lab's "Costumes" tool to customize their pet's appearance. They will then use events, behaviors, and other concepts they have learned to bring their project to life.

Purpose

This lesson allows students to apply programming concepts from prior lessons in another creative context.

CSTA K-12 Computer Science Standards (2017)
    • 1B-AP-10 - Create programs that include sequences, events, loops, and conditionals.
    • 1B-AP-11 - Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process.
    • 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.
    • 1B-AP-13 - Use an iterative process to plan the development of a program by including others' perspectives and considering user preferences.

Agenda

Objectives

Students will be able to:
  • Create an interactive virtual pet using events, behaviors, and custom art.
  • Program solutions to problems that arise when designing a virtual pet, like feeding it.

Preparation

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

Links

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

For the teachers

Vocabulary

  • Behavior - An action in Sprite Lab that a sprite performs continuously until it’s told to stop.
  • Event - An action that causes something to happen.

Teaching Guide

Warm Up (15 minutes)

Introduction

Display: Show “Reflect” slide

Review:

  • Do you remember what an event is?

  • Do you remember what a behavior is?

  • Can you remember some of the behaviors you have used? What do they do?

    • "patrolling"
    • "jittering"
    • "spinning right/left"

Vocabulary

Display: Show “Vocabulary” slide

  • Behavior - An action in Sprite Lab that a sprite performs continuously until it’s told to stop.
  • Event - An action that causes something to happen.

Do This: Revisit events and behaviors in programming. Additionally, introduce the Sprite Lab "Costumes" tool that allows students to draw their own costumes.

Display: Show “Level 1 - Exploration” slide

Display: Begin by showing Level 1 of today's lesson to your students.

Think/Pair: Ask students to predict what will happen when the code is run, and to discuss with their neighbors. Run the code, and discuss the outcome.

Display: Show “Level 2 - Skill Building” slide

Display: Show Level 2. Briefly demonstrate how to do the following:

  • Navigate between the Code and Costumes tabs.
  • Draw a costume.
  • Choose a costume from the costume library.
  • Change the virtual pet's sprite's costume to a custom one.

Main Activity (30 minutes)

Virtual Pet with Sprite Lab

Goal: Today, students will be creating their own virtual pet! They will begin by drawing or selecting a new costume for a sprite. Then they will create events that cause actions and behaviors upon interaction.

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.

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?

Reminder: If puzzles are sharable, remind the students to only share their work with their close friends or family.

Display: Show “Give credit!” slide

Say: Sometimes when we create our own projects we find inspiration from other people’s projects. 

If you have gotten permission to remix a project, make sure to give credit to the original coder.

If you remix a Code.org project:

  1. Add a comment block that explains where you remixed from.
  2. You might also keep the word “Remix” in the title of your project to tell others that this project originally came from someone else.

If you want to remix a friend’s project:

Make sure you get their permission first. Once you get permission, follow the steps above to give them credit.

When you don’t have direct permission to remix someone’s project or upload their images into your project, look for publicly available materials instead.

Display: Show “Level 6 - Project Feedback” slide

Do This: Have students meet in pairs to share their Virtual Pet project. Guide them to ask the questions on the slide and then reflect on modifications they will make based on the feedback they receive.

Display: Show “Level 7 - Free Play” slide

Wrap Up (15 minutes)

Reflection

Display: Show “Reflect” slide

Reflect:

  • What was today's lesson about?
  • What other options would you like to be able to have your pet do?

Cross-Curricular Opportunity

Providing Energy for your Virtual Pet (60-90 minutes)

Computer Science + English Language Arts + Science

Providing Energy for your Virtual Pet is an optional activity aligned to Common Core ELA and Next Generation Science Standards, written by our teacher community. Students will create a scientific model that shows how their virtual pet will receive the energy it needs to survive.

Standards Addressed:

  • CCSS.ELA.RI.5.7: Draw on information from multiple print or digital sources, demonstrating the ability to locate an answer to a question quickly or to solve a problem efficiently.

  • CCSS.ELA.RI.5.9: Integrate information from several texts on the same topic in order to write or speak about the subject knowledgeably.

  • 5- PS3-1: Use models to describe that energy in animals’ food (used for body repair, growth, motion, and to maintain body warmth) was once energy from the sun.

  • 5-LS2-1: Develop a model to describe the movement of matter among plants, animals, decomposers, and the environment

  • SL.5.5: Include multimedia components (e.g., graphics, sound) and visual displays in presentations when appropriate to enhance the development of main ideas or themes.

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.