Lesson 15: Events in Bounce

Overview

In this online activity, students will learn what events are, and how computers use them in programs like video games. Students will work through puzzles making the program react to events (like arrow buttons being pressed.) At the end of the puzzle, students will have the opportunity to customize their game with different speeds and sounds.

Purpose

Events are very common in computer programs, especially in video games.

In this lesson, students will develop their understanding of events by making a sports-based game. Students will learn to make their paddle move according to arrow keys, and make noises when objects collide. At the very end, they will get to customize their game to make it more unique!

Agenda

Warm Up (10 min)

Main Activity (30 min)

Wrap Up (10 min)

Extended Learning

View on Code Studio

Objectives

Students will be able to:

  • Identify actions that correlate to input events.
  • Create an interactive game 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 Teachers

For the Students

Vocabulary

  • Event - An action that causes something to happen.

Support

Report a Bug

Teaching Guide

Warm Up (10 min)

Introduction

Ask the students to come sit down near you. Now tell them to all stand up!

Tell the students what you just did was declare an event and an action. When you say to sit down, it is an event. The action responding to this event is the class sitting down. This is the same when you ask the class to stand up. Events and actions are easily identifiable in our lives.

Some other events and actions include:

  • Feeling hungry and eating food
  • Stubbing your toe and yelling "Ouch!"
  • Getting the basketball in the basket and scoring a point for your team!

Ask the class to come up with a couple of more events. Tell them that they will be making a game where the program will have actions associated to events that they code!

Main Activity (30 min)

CSF Express Course - Website

Teacher Tip

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.

At the end of the set of puzzles, students will have the opportunity to make their game unique. Have the students try new ways to make the game more challenging. For example, try playing with many balls at once, or each time the ball bounces off a wall, launch more balls.

This is what Justin Trudeau, the Prime Minister of Canada, did when he completed an Hour of Code in 2016.

Wrap Up (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?
  • How did you feel during today’s lesson?
  • What did you do to make your game super cool?
  • What kind of game do you want to code in the future?

Extended Learning

Take Me Out to the Ball Game

Take the students outside to play some sort of ball game. Keep track of events and actions. For example, not dribbling in basketball results in a traveling foul and the other team gets the ball. In soccer, kicking the ball out of bounds results in the other team kicking the ball in. Getting the ball to the goal results in a point! Make up more events if your students are into it. Have the all of the students yell "Yippee" when the captain of one team scores a point. Have everyone fall to the ground and roll around if a student makes two goals in a row!

Standards Alignment

View full course alignment

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
  • 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.