Lesson 15: Build a Play Lab Game

Overview

In this online activity, students will have the opportunity to learn how to use events in Play Lab and to apply all of the coding skills they've learned to create an animated game. It's time to get creative and make a game in Play Lab!

Purpose

Students will use events to make characters move around the screen, make noises, and change backgrounds based on user input. This lesson offers a great introduction to events in programming and even gives a chance to show creativity! At the end of the puzzle sequence, students will be presented with the opportunity to share their projects.

Agenda

Warm Up (10 min)

Main Activity (30 min)

Wrap Up (15 min)

Extended Learning

View on Code Studio

Objectives

Students will be able to:

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

Preparation

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.

Support

Report a Bug

Teaching Guide

Warm Up (10 min)

Introduction

Today students will be introduced to events in programming.

  • Event: An action that causes something to happen.

Ask the students to raise their hands in the air.

What you did was declare an event. When you say "raise your hands in the air" the students responded by raising their hands. In coding, you would declare this by saying "when I say 'raise your hands' you will raise your hands".

You can also think of cities also declaring events. There are laws that say "when there is a green light, the cars can move through the intersection". Ask the students why they think this is an event.

Today, students will play in Play Lab, but the events they will be working on will be more like the video games they are used to playing. Events will take the form of actions, such as pressing the up arrow or two characters running into each other.

Review of "Digital Citizenship"

Remind students of information that is safe to share online and information that is strictly private.

SAFE - Personal Information UNSAFE - Private Information
Your favorite food
Your opinion (though it shoud be done respectfully)
First name (with permission)
Mother's maiden name
Social Security number
Your date of birth
Parents' credit card information
Phone number


Discuss other examples of the two categories above.

Main Activity (30 min)

Lesson Tip

Students will have the opportunity to share their final product with a link. This is a great opportunity to show your school community the great things your students are doing. Collect all of the links and keep them on your class website for all to see!

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.

Course D Online Puzzles - Website

This is the most free-form online activity of the course. At the final stage students have the freedom to create a game of their own. You may want to provide structured guidelines around what kind of game to make, particularly for students who are overwhelmed by too many options.

Wrap Up (15 min)

Journaling

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 is an event your program used today?
  • Is there an event that would you like to have used in your game that you did not get to use in Play Lab?

Extended Learning

Use these activities to enhance student learning. They can be used as outside of class activities or other enrichment.

Look Under the Hood

When you share a link to your story, you also share all of the code that goes behind it. This is a great way for students to learn from each other.

  • Post links to completed stories online.
    • Make a story of your own to share as well!
  • When students load up a link, have them click the "How it Works" button to see the code behind the story.
  • Discuss as a group the different ways your classmates coded their stories.
    • What surprised you?
    • What would you like to try?
  • Choose someone else's story and click Remix to build on it. (Don't worry, the original story will be safe.)
View on Code Studio

Student Instructions

To start our game, Pirate Pegleg (actor 1) needs to be able to get around in all directions. Connect the blocks to the correct events to get Pegleg moving.

Get Pegleg to the dragon to solve this puzzle.

View on Code Studio

Student Instructions

Time to add points! Give Pegleg (actor 1) a point when he makes it to the dragon (actor 2).

View on Code Studio

Student Instructions

It's time to use what we've learned about conditionals to make this game amazing. This challenge has two parts:

1) Use a repeat forever loop to make the dragon (actor 2) change between random emotions every second.

2) Add code so that when Pegleg gets to the dragon, he gets two points if the dragon is happy. Otherwise, he should get only one point added to his score.

View on Code Studio

Student Instructions

This is about to get interesting!

Add some code so that the ninja (actor 3) starts chasing Pegleg as soon as the game begins. End the game as a loss if the ninja catches him.

View on Code Studio

Student Instructions

Now we need a way to win.

Add a repeat forever loop that continuously checks if the score is greater than 5, then ends the game as a win when it is.

View on Code Studio

Student Instructions

Wow, this game is hard to win!

Let's customize this game to make it more fun. This challenge has three parts:


1) Slow the ninja down before you set him to chase the pirate.

2) Use a repeat forever loop to check to see if the pirate is in the "safe zone" beneath the line of octopuses (greater than 225 pixels down). If he is, set the ninja to flee the pirate. Otherwise, set the ninja to chase the pirate.

3) We don't want the pirate to stay in the "safe zone" too long! Add code to the if statement above so that if the pirate is in the safe zone, the program will wait one second, then deduct a point as long as he stays beneath the octopus line.

View on Code Studio

Student Instructions

Standards Alignment

View full course alignment

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
  • 1B-AP-11 - Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process.

Cross-curricular Opportunities

This list represents opportunities in this lesson to support standards in other content areas.

Common Core English Language Arts Standards

L - Language
  • 3.L.6 - Acquire and use accurately grade-appropriate conversational, general academic, and domain-specific words and phrases, including those that signal spatial and temporal relationships (e.g., After dinner that night we went looking for them).
SL - Speaking & Listening
  • 3.SL.1 - Engage effectively in a range of collaborative discussions (one-on-one, in groups, and teacher-led) with diverse partners on grade 3 topics and texts, building on others’ ideas and expressing their own clearly.
  • 3.SL.3 - Ask and answer questions about information from a speaker, offering appropriate elaboration and detail.
  • 3.SL.6 - Speak in complete sentences when appropriate to task and situation in order to provide requested detail or clarification.

Common Core Math Standards

MP - Math Practices
  • MP.1 - Make sense of problems and persevere in solving them
  • MP.2 - Reason abstractly and quantitatively
  • MP.4 - Model with mathematics
  • MP.5 - Use appropriate tools strategically
  • MP.6 - Attend to precision
  • MP.7 - Look for and make use of structure
  • MP.8 - Look for and express regularity in repeated reasoning
OA - Operations And Algebraic Thinking
  • 3.OA.3 - Use multiplication and division within 100 to solve word problems in situations involving equal groups, arrays, and measurement quantities, e.g., by using drawings and equations with a symbol for the unknown number to represent the problem.1

Next Generation Science Standards

ETS - Engineering in the Sciences
ETS1 - Engineering Design
  • 3-5-ETS1-2 - Generate and compare multiple possible solutions to a problem based on how well each is likely to meet the criteria and constraints of the problem.