Lesson 5: 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

  • Make sure every student has a journal.
  • Play through the puzzles to find any potential problem areas for your class.
  • Read the "Events in Bounce - How Do They Happen?" slide deck (to be presented to students at end of class).

Links

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

For the Teachers

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)

Online Puzzles

Teaching 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.

Wrap Up (10 min)

Assessment

Teaching Tip

Although introduced in this lesson, the slide deck "Events in Bounce - How Do They Happen?" can be applied more generally to express the relationship between hardware and software. Particularly, the final slide simplifies the input-to-output sequence and can be made into a poster for your classroom.

Present the Events in Bounce - How Do They Happen? slide deck to students. Allow them to record the correct order of events on the second slide in their journals first. Call on a few students to share their answers before revealing the third slide. Discuss the correct sequence with the class.

Correct Order: D, B, A, C

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!

View on Code Studio

Student Instructions

Get to the hoop!

Attach a block to the when left arrow event and press "Run" to move the player to the net.

View on Code Studio

Student Instructions

Now, attach a block to the when right event so that the hand can get to both baskets.

View on Code Studio

Student Instructions

We're going to send a basketball flying down towards the hand. Attach a block to the when ball hits hand event to ensure the ball reaches the basket.

View on Code Studio

Student Instructions

Now the basket is at the top.

Attach code to make the ball bounce when it hits the wall so you can solve this puzzle.

View on Code Studio

Student Instructions

Attach sound blocks to make the net swish when you hit the basket and have the whistle blow when the ball misses your hand.


Bounce the ball until it hits the finish target.

View on Code Studio

Student Instructions

There is now a hoop at the top.

Attach the score point block to the when ball in goal event and the score opponent point block to the when ball misses hand event to make a game.


See how many points you can score before your opponent scores twice.

View on Code Studio

Student Instructions

Now, you are in control of the ball! Attach the throw new ball block in all of the places where the game needs a new ball.


See how many points you can score before your opponent scores twice!

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

Student Instructions

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.
CS - Computing Systems
  • 1B-CS-01 - Describe how internal and external parts of computing devices function to form a system.
  • 1B-CS-02 - Model how computer hardware and software work together as a system to accomplish tasks.

Cross-curricular Opportunities

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

Next Generation Science Standards

ETS - Engineering in the Sciences
ETS1 - Engineering Design
  • 3-5-ETS1-1 - Define a simple design problem reflecting a need or a want that includes specified criteria for success and constraints on materials, time, or cost.