< Course C (2023)

Lesson 12: Build a Flappy Game

60 minutes

Overview

This lesson combines skill-building around events with a mini-project where students get to build their own Flappy Bird game. At the end of the lesson, students will be able to customize their game by changing the visuals or rules.

Purpose

Events are very common in computer programs. In this lesson, students will further develop their understanding of events by making a Flappy Bird game. Students will learn to make their character move across the screen, make noises, and react to obstacles based on user-initiated events.

CSTA K-12 Computer Science Standards (2017)
    • 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.
    • 1A-CS-01 - Select and operate appropriate software to perform a variety of tasks and recognize that users have different needs and preferences for the technology they use.

Agenda

Objectives

Students will be able to:
  • Create a game using event handlers.
  • Match blocks with the appropriate event handler.
  • Share a creative artifact with other students.

Preparation

  • Play through the puzzles to find any potential problem areas for your class.

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.

Teaching Guide

Warm Up (10 minutes)

Teaching 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. Monitor and collect all of the links to the projects and keep them on your class website for all to see!

Reflect

Display: Show “Reflect” slide

Reflect: When have you seen a character touch another object as an event in a game?

For example: Your character hits something with a tool and it breaks.

Vocabulary

Display: Show “Vocabulary” slide

  • Event - An event is an action that causes something to happen.

Introduction

Display: Show “Quick Review” slide

Say: What did we "program" the button click events to do?

Display: Show “Add Events to Coding” slide

Say: Now we're going to add events to our coding. We're going to create an event for clicking the mouse and one for when the bird hits an object - like the ground or an obstacle.

Bridging Activity - Choose One (10 minutes)

These activities 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:

Unplugged Activity Using Paper Blocks

Using the remote from the *Event Controller and *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.

-Or-

Preview of Online Puzzles as a Class

Display: Show “Bridging Activity” slide

Pull a lesson from the corresponding online stage, we recommend puzzle 4.

Say: What should happen when the "Flappy Bird" runs into something like the ground or an obstacle?

Explain that "Flappy" in this game will move forward with a click of the mouse and the game will end if "Flappy" runs into anything.

Complete the puzzle with the class and allow time for a quick discussion on what was and wasn't an event. For every event, ask the students what the action corresponding to this event is.

Main Activity (30 minutes)

Build a Flappy Game

Online Puzzles and Free Play

This entire lesson builds towards students creating their own Flappy game, but the second half of the levels are all linked. This means students will see their own code as they move between bubbles 6-10, allowing for more personal customization that will carry all the way to the final product.

In the final stage of this lesson students are able to tweak their game to make it unique - encourage them to see how different they can make each game within the constraints provided. If the class doesn't use pair programming, then tell students to go around and look at other student's games. Otherwise, have students discuss and try out different ways to set up their game with their partner.

Display: Show “Code Your Own Flappy Game” video

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 .

Wrap Up (10 minutes)

Reflection

Display: Show “Reflect” slide

Reflect: What did you do to make your game unique?

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 game, 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 games online or on the board.
    • Make a game 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 game.
  • Discuss as a group the different ways your classmates coded their games.
    • What surprised you?
    • What would you like to try?
  • Choose someone else's game and build on it. (Don't worry; the original game will be safe.)

Cross-Curricular Opportunity

Become a Game Designer (45-135 minutes)

Computer Science + Math + Science

Become a Game Designer is an optional activity aligned to Common Core Math and Next Generation Science Standards, written by our teacher community. Students will become Game Designers as they create and test a game. Students will also record scores, make observations, create a bar graph, analyze the results and justify the changes they would make to their game.

Standards Addressed:

  • 2.MD.D.10: Draw a picture graph and a bar graph (with single-unit scale) to represent a data set with up to four categories.

  • K-2 ETS1-1: Ask questions, make observations, and gather information about a situation people want to change to define a simple problem that can be solved through the development of a new or improved object or tool.

  • K-2 ETS1-3: Analyze data from tests of an object or tool to determine if it works as intended to compare the strengths and weaknesses of how each performs.

Creative Commons License (CC BY-NC-SA 4.0).

This work is available under a Creative Commons License (CC BY-NC-SA 4.0).

If you are interested in licensing Code.org materials for commercial purposes contact us.