← Back to Library
Lesson PlanFreeEN

CyberPi: Dodge the Bird II

In this lesson students will continue working the Dodge the Bird and continue their understanding of data in game creation. Students will understand the role and importance of data in game design. They will then draw a mind map to analyze the basic effects of Dodge the Bird and complete the code based on the mind map.

Gr. 7–8
CyberPi: Dodge the Bird II

Lesson

Overview

Description

In this lesson students will continue working the Dodge the Bird and continue their understanding of data in game creation. Students will understand the role and importance of data in game design. They will then draw a mind map to analyze the basic effects of Dodge the Bird and complete the code based on the mind map.

Objectives

  • Explain the roles of data in player character design

  • Develop a game that allows players to choose a player character

  • Draw a mind map to analyze the features of Dodge the Bird

  • Use variables and complete the advanced version of Dodge the Bird

Before the Lesson

Preparation

For the teacher and students:

Example program(s): CyberPi – Lesson 14 - Dodge the Bird 2

For students:

  • Proficiency in block-based coding

  • Knowledge of game design process and ability to design basic game mechanics

  • Completed Lesson 13 - Dodge the Bird 1

Review

Warm Up

Objective:

  • Recap the previous lesson and clarify the objectives of this lesson.

Procedures:

  • Show students the complete version of Dodge the Bird.

  • Summarize: Last time we completed the following features:

  1. control of a player character's movement

  2. a penalty system: if a player character touches a hazard, it loses a life

  3. a decision structure: if a player character is out of lives, the game ends

  • We'll continue developing the game, adding a feature that allows players to choose a player character.

Direct Instruction

Tour of mBlock 5

1. Open the mBlock software or mBlock 5 Web version.

2. Introduce students to the following key areas of the software interface:

Connect the CyberPi

3. Plug the CyberPi into the computer using the included cable. The CyberPi should boot up and the screen will display either the last program uploaded or the Home menu.

4. On the "Devices" tab in mBlock, click the "Add" button. Select CyberPi and click "Ok".

5. Click the "Connect" button. Then, select the USB port and click "Connect".

6. If connected successfully, the button will change to "Disconnect".

Guided Practice

Hands On

Objective:

  • Instruct students to analyze a project with a mind map, preparing them for the programming session.

Procedures:

  • Work with students to analyze the features of Dodge the Bird.

  • Instruct students to draw a mind map:

Independent Practice

Try It!

Objective: 

  • Give students the freedom to explore further so that they can enhance their programming skills.

Procedures:

  • Open the preset program that has the basic game features.

  • Connect CyberPi to mBlock.

Design a player character selection page:

  • In the programs we wrote during the previous lesson, the game begins as soon as we press the start button. 

  • Let's make a small change to the program. When we press the button, we enter a player character selection page. 

  • The player character selection page includes two parts: instructions and player characters.

  • Instructions: Click the sprite Title and instructions and find the costume selection instructions.

  • Character options: Display the player characters, Jinnee and Witch, on the stage.

NOTE:

  • To make sure every game has a fresh start, use the stop other scripts in this spriteblock.

Select a player character:

  • Joystick to the left: Jinnee 

  • Joystick to the right: Witch

  • To make it easier to extend the character selection feature, create a variable Mode to record players’ options. "1" is Jinnee is and "2" Witch.

NOTE:

1. To make sure every game has a fresh start, use the stop other scripts in this sprite block.

2. To make sure a player can't select characters after the game begins, use broadcast ( ) and wait. 

  • After the player confirms the player character, the game starts.

  • The Title and instructions sprite disappears when the game starts: 

  • The character chosen by the player appears on the stage. That is, when selecting Jinnee, the player continues the game as Jinnee. Build on the program that was created in the previous lesson.

  • To make the program easier to understand, create a function CharacterStatus to record a character's status after the game starts:

  • Include the function CharacterStatus and the variable Mode in the script:

NOTE:

1. Based on the scripts for Jinnee, complete the ones for Witch, including an animated effect, player character status, up/down movement, and a game-over effect.

2. Functions can't be shared across sprites. So, duplicate the scripts into the sprite Witch and then create and define the function in the scripts area of Witch. 

Result—Win:

  • Last time, we completed the structure that decides whether a player loses the game. Now let's add another decision structure to tell whether a player wins. Set the game length to 100 seconds. If the character stays alive for 100 seconds, it means the character reaches the destination and the player wins.

  • Make decisions based on time: Create a variable time to record the length of each game.

NOTE:

  • You can add the script that records the game length to any sprite, but it's better to put it  in a sprite that has fewer scripts. In the example program, the length-recording script is under the sprite sign.

Decide whether a player wins:

NOTE:

1. Join the blocks for deciding the result as shown:

2. Animated timer: Displaying the game time on the stage helps players know the game progress in real time. Do you still remember how we displayed scores in Fish Carnival Game? Use the same method to display the game time.

  • For the sprite Hundreds, divide the time by 100 and round the result down. For example, 

120/100=1.2, round 1.2 down to 1

260/100=2.6, round 2.6 down to 2

  • Do the similar with the sprite Tens, dividing the time by 10 and round down the result:

NOTE: 

1. Take "130/10=13" as an example. The result is 13 but the sprite has only 10 looks. So, the sprite turns to its third look, "3". 

2. As for the sprite Ones, use ( ) mod ( ). For example, 4/10=0.4, and take the remainder "4".

  • Based on the game effects, these digits (Hundreds, Tens, and Ones) don't appear on the startup, character selection, and victory interfaces, and they stop updating when the game ends. To achieve these effects, write the following scripts: 

Add the victory effects:

  • Destination appears: 

  • Character animation: 

NOTE:

  • The example programs are for the Sprite Jinnee. Duplicate the scripts into Witch.

Extensions

  • If students have not attempted the extensions from last lesson they can try to implement them now. They are listed below:

  1. Have students speed up the birds to increase the level of difficulty overtime

  2. Have students add a second bird to increase the level of difficulty overtime

  • Have students add a powerUp sprite. This can be increased player speed or making the player smaller.

Wrap Up

Wrap-Up & Quick Check

Objective:

  • Allow students time to try the game that they developed and have them think about the applications of data in other games.

Procedures:

  • Invite two students to try the game and let them compete to see who can finish the game.

  • Explain: Dodge the Bird needs data to complete its features. Whether CyberPi’s button is pressed and whether CyberPi is tilted forward or backward are all reported to the program as data. We used variables, like Lives and Time to keep a record of all the data we want. And the major feature, player character selection, relies on the data stored in the variables to call upon the corresponding scripts.

  • Ask: Think about the games you’ve played. Which features of them may involve data?

Downloadable Material

Example Program

Educational Standards

CSTA

CSTA

  • 2-AP-11: Create clearly named variable that represent different data types and perform operations on their values.

  • 2-CS-02: Design projects that combine hardware and software components to collect and exchange data.

  • 2-AP-13: Design projects that combine hardware and software components to collect and exchange data.

ISTE

ISTE

  • 5c: Students break problems into component parts, extract key information, and develop descriptive models to understand complex systems or facilitate problem-solving.

Alberta - Grade 7-8 - CTF

Grade 7-8

CTF

  • Planning, creating, appraising and communicating in response to challenges.

  • Working independently and with others while exploring careers and technology.

British Columbia - Grade 7-8 - ADST

Grade 7

ADST

• Generate potential ideas and add to others’ ideas

• Identify and evaluate the skills and skill levels needed, individually or as a group, in relation to a specific task, and develop them as needed

• Select, and as needed learn about, appropriate tools and technologies to extend their capability to complete a task

Grade 8

ADST

• Generate potential ideas and add to others’ ideas

• Make a plan for production that includes key stages, and carry it out, making changes as needed

• Identify and evaluate the skills and skill levels needed, individually or as a group, in relation to a specific task, and develop them as needed

• Select, and as needed learn about, appropriate tools and technologies to extend their capability to complete a task

Manitoba - Grade 7-8 - Science

Grade 7

Science (Overall Skills and Attitudes)

  • 7-0-4a Carry out procedures that comprise a fair test. Include: controlling variables, repeating experiments to increase accuracy and reliability.

  • 7-0-4c Work cooperatively with team members to carry out a plan, and troubleshoot problems as they arise.

Grade 8

Science (Overall Skills and Attitudes)

  • 8-0-4a Carry out procedures that comprise a fair test. Include: controlling variables, repeating experiments to increase accuracy and reliability.

  • 8-0-4c Work cooperatively with team members to carry out a plan, and troubleshoot problems as they arise.

New Brunswick - Grade 7-8 - Science

Grade 7-8

Science (Attitude Outcome)

  • 425 show a continuing curiosity and interest in a broad scope of science-related fields and issues

  • 430 persist in seeking answers to difficult questions and solutions to difficult problems

  • 431 work collaboratively in carrying out investigations, as well as in generating and evaluating ideas

Newfoundland & Labrador - Grade 7-8 - Science

Grade 7-8

Science

  • GCO: Skills - Students will develop the skills required for scientific and technological inquiry, for solving problems, for communicating scientific ideas and results, for working collaboratively, and for making informed decisions.

Nova Scotia - Grade 7-8 - ICT & Mathematics

Grade 7

Technology

  • GCO1: Students will be expected to design, develop, evaluate, and articulate technological solutions.

  • GCO2: Students will be expected to operate and manage technological systems.

Mathematics

PR05 Students will be expected to evaluate an expression given the value of the variable(s). 

Performance Indicator: 

PR05.01 Substitute a value for an unknown in a given expression and evaluate the expression. 

PR02 Students will be expected to create a table of values from a linear relation, graph the table of values, and analyze the graph to draw conclusions and solve problems. 

G02 Students will be expected to identify and plot points in the four quadrants of a Cartesian plane, using integral ordered pairs. 

Performance Indicators: 

G02.01 Label the axes of a four quadrant Cartesian plane and identify the origin. 

G02.02 Identify the location of a given point in any quadrant of a Cartesian plane using an integral ordered pair. 

G02.03 Plot the point corresponding to a given integral ordered pair on a Cartesian plane with units of 1, 2, 5, or 10 on its axes. 

Grade 8

Technology

  • GCO1: Students will be expected to design, develop, evaluate, and articulate technological solutions.

  • GCO2: Students will be expected to operate and manage technological systems.

Ontario - Grade 7-8 - Mathematics

Grade 7

Mathematics

Algebra

  • C3.1 solve problems and create computational representations of mathematical situations by writing and executing code, including code that involves events influenced by a defined count and/or sub-program and other control structures

Grade 8

Mathematics

Algebra

  • C3.1 solve problems and create computational representations of mathematical situations by writing and executing code, including code that involves the analysis of data in order to inform and communicate decisions

Prince Edward Island - Grade 7-8 - Science

Grade 7-8

Science

  • GCO: Skills - Students will develop the skills required for scientific and technological inquiry, for solving problems, for communicating scientific ideas and results, for working collaboratively, and for making informed decisions.

Quebec - Grade 7-8 - Science

Grade 7-8

Science (Strategies)

  • Exploring various ways of solving the problem

  • Exchanging information

  • Comparing different possible explanations for or solutions to a problem in order to assess them (e.g. full-group discussion)

Saskatchewan - Grade 7-8 - Science

Grade 7-8

Science (Goals)

  • Develop Scientific and Technological Skills – Students will develop the skills required for scientific and technological inquiry, problem solving, and communicating; for working collaboratively; and for making informed decisions.