Lesson 12: A Royal Battle with Events

Overview

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

Purpose

In this online activity, students will learn how to use events in Play Lab. They will start by training the knight to move when an arrow key is pressed, then end with the opportunity to showcase the rest of the skills that they learned throughout this course, including sequence and looping, as part of the final freeplay puzzle.

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 sequences and event-handlers.
  • Share a creative artifact with other students.

Preparation

  • Play through the puzzles to find any potential problem areas for your class.
  • (Optional) Pick a couple of puzzles to do as a group with your class.
  • Review CS Fundamentals Main Activity Tips - Lesson Recommendations.
  • Make sure every student has a Think Spot Journal - Reflection Journal.

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

Review "The Big Event" activity with students:

  • What did we "program" the button events to do?

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)

This activity will help bring the unplugged concepts from "The Big Event" into the online world that the students are moving into. Choose one of the following to do with your class:

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.

Unplugged Activity Using Paper Blocks

Using the remote from the The Big Event (Courses A, B) - Worksheet and Unplugged Blockly Blocks (Grades K-1) - Manipulatives, gather your class to reprise the activity from the previous lesson. Ask the class "when the teal button is pushed, what do we do?" then fill in one of the when event blocks and one of the blue action blocks accordingly. Make sure that the students understand that the when blocks need to be on top of the blue block and they need to touch in order for the program to run.

Previewing Online Puzzles as a Class

Pull a puzzle from the corresponding online puzzles. We recommend puzzle 4 of this stage. Call on different students to make a funny face representing a mood when you click on Daisy. Explain this is an event that they are reacting to and Daisy can be coded to change moods when you click on her.

Main Activity (30 min)

Online Puzzles and Free Play

This is the most free-form plugged activity of the course. At the final stage 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.)
  • Create a Story
  • 1
  • (click tabs to see student view)
  • Free Play
  • 2
  • (click tabs to see student view)
View on Code Studio

Teaching Tip

This is a free-play level. Because it shows up at the beginning of the lesson, it is intended to serve as a "sandbox" where students can experiment with new blocks While students are not actually required to write any code in this level, doing so will allow them to make discoveries of their own before being asked to perform specific tasks. Encourage your students to take their time here.

Student Instructions

This game is called "Play Lab".

See if you can figure out what each block does.

View on Code Studio

Student Instructions

Have Daisy the Dragon say something when you click "Run".

View on Code Studio

Student Instructions

Use an event to make Daisy the Dragon switch to a random mood when you click on her.

View on Code Studio

Student Instructions

Knight time! Get the dragon to finish this level.

Add an event so that the knight moves toward the dragon when the left arrow is clicked.

View on Code Studio

Student Instructions

Now add an event so that the knight runs away from the dragon when you press the right arrow.

Move the knight to the right to pass this level.

View on Code Studio

Student Instructions

Help your knight get all of the flags!

To do this, you'll need to add events to help the knight move up, down, left, and right.

View on Code Studio

Student Instructions

Make this game fun by adding more things!

1) Set the knight to vanish when he runs into the dragon.
2) Play a sound when they collide to make it feel more real.


Visit all of the goals, then run into the dragon to pass the level.

  • Free Play
  • 9
  • (click tabs to see student view)
View on Code Studio

Teaching Tip

This is a free-play level. This is not only a great place to point students who are progressing quickly, but a place for all students to really express their creativity. While students are not actually required to write any code in this level, doing so will allow them to apply what they have learned in a way that is more meaningful to them. Encourage your students to take their time here.

Student Instructions

Free play: Use your imagination. What can you do to make this game more fun?

View on Code Studio

Teaching Tip

This lesson extra 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

It's time for the Great Animal Race! Make the animals move down when you press .

Who will run the fastest?

View on Code Studio

Student Instructions

Let's make the animals disappear when you click on them. Try playing with the dog now, then help the other animals join in the fun. You can also add sounds and score points to create a game of Animal Tag!

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.