Lesson 10: On the Move with Events

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 story in the Play Lab!

Purpose

Students will further develop their understanding of events using Play Lab today. Events are very common in most computer programs. In this activity, students will use events to make a character move around the screen, make noises, and change backgrounds based on user-initiated events.

Agenda

Warm Up (10 min)

Bridging Activity - Events (10 min)

Main Activity (30 min)

Wrap Up (5 - 10 min)

Extended Learning

View on Code Studio

Objectives

Students will be able to:

  • Identify actions that correlate to input events.
  • Create an animated, interactive story using sequence and event-handlers.
  • Share a creative artifact with other students.

Preparation

Links

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

For the Students

Vocabulary

  • Event - An action that causes something to happen.

Support

Report a Bug

Teaching Guide

Warm Up (10 min)

Content Corner

Teaching this course as a class?

Our grade-aligned CS Fundamentals courses use unplugged lessons to build community and introduce tricky computer science concepts, including events. Check out the lesson The Big Event Jr. from Course A!

Introduction

Now we're going to add events to our code. Specifically, we're going to have an event for when two characters touch each other.

  • When have you seen two characters touch each other as an event in games?

Bridging Activity - Events (10 min)

Previewing Online Puzzles as a Class

Pull a puzzle from the corresponding puzzles online. We recommend puzzle 7. Call on different students to make a funny noise when you click on Jorge. Explain this is an event that they are reacting to and Jorge can be coded to make noise when you click on him.

Main Activity (30 min)

Online Puzzles and Free Play

At the final level students have the freedom to create a story of their own. You may want to provide structured guidelines around what kind of story to write, particularly for students who are overwhelmed by too many options.

Wrap Up (5 - 10 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?
  • Draw one of the Feeling Faces - Emotion Images that shows how you felt about today's lesson in the corner of your journal page.
  • Draw an event you used in your program today.
  • Imagine that you have a remote controlled robot. What would the remote look like? Draw a picture of what you think you could make the robot do.

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

This is a Play Lab level. Move blocks to the workspace and see what happens!

View on Code Studio

Student Instructions

Jorge the Dog wants to say "Hi there." Can you help him?

View on Code Studio

Student Instructions

Help Jorge the Dog get moving by connecting the move dog west block to the when left arrow event block that is already in the workspace.

Use the arrow keys or press the arrow buttons to move Jorge to the flag and finish the level!

View on Code Studio

Student Instructions

Now, add another event block to get Jorge to move right when the right arrow button is clicked. Use the arrow keys or press the arrow buttons to move Jorge to both flags and finish the level!

View on Code Studio

Student Instructions

Add events to have Jorge move up and down when the \up\ and \down\ buttons are pressed. Make Jorge get the flags to finish the level!

View on Code Studio

Student Instructions

Make this more interesting by changing the background and playing a random sound when Jorge is clicked. When your code is ready, click on Jorge to try it out!

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

Freeplay: Add anything you want to this game. Can you make the dinosaur disappear when Jorge runs into him?

View on Code Studio

Student Instructions

Give everyone something to do when you click on them. What will the animals say? What else will happen?

In this puzzle, make sure to click for hints. The hints will give you fun things to try!

View on Code Studio

Student Instructions

Clicking Olive will make Robin appear! Can you write code to show the rest of the characters too?

In this puzzle, make sure to click for hints! The hints will help you do this project step-by-step!

Standards Alignment

View full course alignment

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
  • 1A-AP-09 - Model the way programs store and manipulate data by using numbers or other symbols to represent information.
  • 1A-AP-11 - Decompose (break down) the steps needed to solve a problem into a precise sequence of instructions.