← Back to Library
Lesson PlanFreeEN

CyberPi: Colour Hunter

Block-Based: Advanced Description In this lesson students will understand the basic game design principles and analyze the mechanics of a game. Students will use mind maps to visualize features the ga

Gr. 7–8
CyberPi: Colour Hunter

Lesson

Overview

Description

In this lesson students will understand the basic game design principles and analyze the mechanics of a game. Students will use mind maps to visualize features the game should have and program the game based on their mind map.

Objectives

  • Describe basic game design principles and explain the mechanics of a game.

  • Use mind maps to analyze what features the game Colour Hunter should have.

  • Use variables to make the game.

Before the Lesson

Preparation

For the teacher and students:

Example program(s): CyberPi – Lesson 9 - Colour Hunter

For students:

  • Proficiency in block-based coding

  • Prior knowledge of CyperPi's major features

  • Basic knowledge on sensors and able to apply variables

Review

Warm Up

Objective: 

  • Have students figure out what stages a game often has, and let them categorize these stages to engage them in the game design process.

Procedures:

  • Ask students to think about how many phases most games often have.

  • Summarize the answers: Considering the gaming experience, we could divide a game into 3 phases: Opening, Middlegame, Endgame. 

  • Say: Suppose you are a game designer, so your responsibility is to design an engaging game. You have many things to consider when you're designing a game:

1. Task: What's the task that a player needs to complete?

2. Controls: How does a player interact with the game?

3. Outcome: What outcome will the player get? How is this outcome reached? 

  • Use specific game examples for analysis.

  • Ask: Pick a game that most people are familiar with. Analyze its tasks, controls and outcome. 

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:

  • Show students how the game works and encourage them to consider how to turn their ideas into reality. To help them develop their independent thinking skills.

Procedures:

  • Invite students to try the Colors Hunter game.

  • Ask: If you are a game designer, what do you think the task and control methods are? And what's the outcome?

  • Task: Follow CyberPi's command to select a light colour accordingly.

  • Control method: Use the joystick to select a color.

  • Outcome: When the 30-second countdown stops, the game is over. There's no win or lose condition.

  • Show students the mind map.

Independent Practice

Try It!

Objective:  

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

Procedures:

  • Connect CyberPi to mBlock.

  • Press the button to start the game: 

Add a prompt to indicate the start of the game.

  • Press the button, and the game starts:

NOTE:

1. The variable score is created to store the scores. Make sure the scores are cleared before the game begins.  

2. The timer tracks the gaming time, and should be reset to zero at the very beginning of the game.  

  • The system randomly selects a target: 

  • CyberPi will randomly display one of the three words, red, yellow and blue, on its screen each single time.

  • Use a variable target in the program to simulate a test in which a target colour is randomly given each time. 

  • For example, when target equals 1, the word red appears on the screen; when target equals 2, the word yellow appears on the screen; when target equals 3, the word blue appears on the screen.

NOTE:

1. Use the forever block to keep refreshing the proposed targets;

2. Change the value in the wait () secs to adjust the level of difficulty.

Set up changes:

  • To make the game more challenging and engaging, it's better to add some changes.

  • For example, program the texts to appear in random colors on the screen.

  • Press the joystick to confirm the colour. After CyberPi gives a target colour, the player is expected to pinpoint the target among changing colours using the joystick. 

Keep colours changing:

  • Create a variable named LightColor to change the colours of the lights. The variable is used to decide whether the player's selection is correct as well.

NOTE:

  • Use the block wait (1) sec to allow the player time to complete his or her selection. The player faces greater challenges when the interval time is shorter. 

Press the joystick to confirm color:

  • Compare the target and the current light colour:

  • Scoring system: Create a variable score to store the points that the player wins. The score increases by 1 when the player's selection matches the target. 

NOTE:

  • Use sounds and texts to let the player know whether he or she picks the correct colour.

  • Result: The countdown starts when the game begins. After 30 seconds, the game stops and shows the final score. 

Extensions

  • Have students graph the number of correct and wrong answers

  • Have students create a HighScore variable that stores the highest scored received

Wrap Up

Wrap-Up & Quick Check

Objective:

  • Ask students to try the game they just created and have them continue to practice game design.

Procedures:

  • Have 2 students compete to see who gets the highest scores

  • Have students create a simple game based on the principles mentioned today: task, controls, and outcome.

Downloadable Material

Example Program

Educational Standards

K12 CS Framework

K12 CS Framework

  • Practice 3-1: Create a computational artifact for practical intent, personal expression, or to address a societal issue.

CSTA

CSTA

  • 2-AP-11: Create clearly named variables 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.

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. 

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. 

Performance Indicators: 

PR02.01 Create a table of values for a given linear relation by substituting values for the variable. 

PR02.02 Create a table of values, using a linear relation, and graph the table of values (limited to discrete elements). 

PR02.03 Sketch the graph from a table of values created for a given linear relation, and describe the patterns found in the graph to draw conclusions (e.g., graph the relationship between n and 2n + 3). 

PR02.04 Describe, using everyday language, in spoken or written form, the relationship shown on a graph to solve problems. 

PR02.05 Match a given set of linear relations to a set of graphs. 

PR02.06 Match a given set of graphs to a given set of linear relations. 

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.

Mathematics

PR01 Students will be expected to graph and analyze two-variable linear relations. 

Performance Indicators: 

PR01.01 Determine the missing value in an ordered pair for a given equation. 

PR01.02 Create a table of values by substituting values for a variable in the equation of a given linear relation. 

PR01.03 Construct a graph from the equation of a given linear relation (limited to discrete data). 

PR01.04 Describe the relationship between the variables of a given graph. 

SP01 Students will be expected to critique ways in which data is presented. 

Performance Indicators: 

SP01.01 Compare information provided for the same data set by a given set of graphs, including circle graphs, line graphs, bar graphs, and pictographs, to determine the strengths and limitations of each graph. 

SP01.02 Identify the advantages and disadvantages of different graphs, including circle graphs, line graphs, bar graphs, and pictographs, in representing a given set of data. 

SP01.03 Justify the choice of a graphical representation for a given situation and its corresponding data set. 

SP01.04 Explain how the format of a given graph, such as the size of the intervals, the width of the bars, and the visual representation, may lead to misinterpretation of the data. 

SP01.05 Explain how a given formatting choice could misrepresent the data. 

SP01.06 Identify conclusions that are inconsistent with a given data set or graph, and explain the misinterpretation. 

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.