Programming 101 Lesson Plan

Lesson: Keeping Score
Time: 60+ mins

Introduction

Game on! In this lesson, students will create a simple game and learn how to keep score using a pre-programmed Actor called “Score.”

New Code Blocks

  • : Listen for a message or broadcast from other scripts before activating.
  • : Return a random number between two parameters.

Vocabulary

  • Random Number: A number that is selected without purpose and has no specific pattern.

Objectives

Students will...
  • Use code blocks to keep track of score in games
  • Apply coding concepts to generate a random number from a given range of numbers
  • Apply coding concepts to make characters respond to messages they receive
  • Create a game where characters appear and disappear in random places

Materials

  • Computers, laptops, or mobile devices (1 per student) with student account access to Tynker.com

Warm-Up (15 minutes)

Lead a mini-discussion with your students:
  • List at least three different games that keep track of score. (Sport games, arcade-style games, Stickman Soccer, Flappy Bird, Tetris)
  • What is the purpose of keeping track of score in a game? Do you think the game would be more exciting or less fun if it didn’t track score? Why?
  • Explain to your students that they will be creating a game where characters appear and disappear in random places, and score is kept.

Activities (45 minutes)

Facilitate as students complete all Keeping Score modules on their own:
1. Introducing Random Numbers (Video)
  • Students will watch a short video where Professor Ada uses dice to introduce the concept of random numbers.
2. Concepts (Video)
  • This module introduces three coding concepts:
    • “When I receive” block- This block is necessary for an Actor to do something with a message it gets from a “broadcast” or “message” block.
    • "Pick a random number" block- Ada illustrates a variety of ways that the block can be used to generate a random number.
    • "Score"- This is a special Tynker Actor that is pre-programmed to keep track of and display the score during a game. You send the Actor messages telling it what to do with the score.
3. Balloon Game Example (Example)
  • Students will view a balloon game project, then create their own version in the next module!
  • Tell students to pop the balloon by tapping (for mobile) or clicking (for web) on it.
4. Balloon Game (DIY)
  • In this DIY project, students will program a balloon to fly up in the sky when they press the “Start” button, and pop when they tap or click it!
  • Students will program two Actors: a balloon and “Start” button. Students will add code to the “Start” Actor to broadcast a start message to all Actors when clicked or tapped.
  • Emphasize to students that the “when I receive” code block listens for a message or broadcast from other scripts before activating. In this example, the balloon Actor uses a “when I receive” code block so that when it receives the start message, it begins to rise up slowly.
5. Balloon Game II Example (Example)
  • Students will view an example of a project that expands on their balloon game by repositioning the balloon and moving the ballon when it’s popped.
  • Tell students to click the “Start” button to start the game.
6. Balloon Game II (DIY)
  • In this DIY project, students will enhance their balloon game by randomizing the balloon placement, allowing the balloon to reappear after it is popped.
  • This version of the game uses new random number concepts, as well as concepts learned in previous lessons (e.g., “hiding” and “showing”)
  • Students are introduced to the “pick random” code block, which chooses the x-value for where the balloon will appear on the Stage. Note: The y-value will always be -200, so it can always start at the bottom of the Stage.
  • The “pick random” block always needs to be given a lowest number and highest number to pick from.
  • Emphasize to students that the “pick random” block is always dragged inside another code block.
  • Encourage students to repeatedly push the “Start” button so they have a visual representation of the “pick random” block being applied to the balloon Actor--which causes the balloon to appear randomly across the screen!
7. Adding Score Example (Example)
  • In this module, students will view a balloon game that uses a Score counter!
  • Ask students, “What did the Score Actor do?” (Keep track of how many balloons were popped)
8. Adding Score (DIY)
  • In this DIY project, students will add on to their balloon game by including a Score Actor, which keeps track of how many balloons are popped!
  • Students are introduced to a pre-programmed Actor called “Score,” that sends a message every time a balloon is popped, tracking the number of pops.
  • When students play the game, they can now see their score on the Stage.
9. Pop the Candy (Puzzle)
  • To solve this puzzle module, students will need to add a popping animation and score to the jelly bean popping game.
  • Give a hint: Tell students that they need to program Codey to move by following the mouse pointer or touch location.
  • Are students struggling? Tell them that their code blocks need to: Add 1 to the score; move through 8 costumes that each jelly bean uses when it pops; and make the jelly bean disappear. Also tell students that their “send message” block should add score to “Score.”
10. Ghost Game Example (Example)
  • In this module, students will view an example of a ghost hunting game!
  • Students can earn points by clicking or tapping on the ghosts.
11. Ghost Game (DIY)
  • In this DIY project, students will create a fun ghost hunting game!
  • Activities include programming a ghost to appear and disappear in random locations, and increasing the score whenever a ghost is clicked or tapped on.
  • Students will need to use two “pick random” blocks inside the “go to” block, one for the x-value and one for the y-value. Remind students of the screen bounds in both the x- and y-directions.
  • Emphasize to students that this game is different from the balloon-popping game--when you click or tap on the ghost Actor, it doesn’t pop.
  • Did students finish early? Encourage them to enhance their game by adding a ghostly sound to the background and adding a sound when a ghost Actor is clicked or tapped on.
12. Quiz (Multiple-Choice)
  • Students will be asked 5 multiple-choice questions to review concepts from this lesson.

Extended Activities (10 minutes)

Ghost Game 2.0
  • Ask the class for ideas on how they could change their coding so the Ghost Game is made harder. (Shorten the time in the “wait” block while the ghost is visible.) How could the game be made easier? (Lengthen that “wait” time.)
  • Ask students to offer ideas on how they could use code blocks or modify their code to determined if they won or lost the Ghost Game. Do they know all the code blocks at this point that they would need to do this? (Check the time elapsed against a maximum time allowed. If the Score reaches some number of ghosts before the timer runs out, they win. Otherwise, they lose. They can't code this yet, because they haven't learned code blocks for comparing two numbers and taking some action "If" one number is larger than the other. But they will learn that in the very next lesson!)

U.S. Standards

  • CCSS-Math: 1.NBT.B.2, 2.OA.B.2, 3.NBT.A.2, 5.G.A.1, 6.NS.C.6, MP.1
  • CCSS-ELA: RF.1.1, RF.2.4, RF.2.4.A, RF.3.4.A, RF.4.4.A, RI.2.6
  • CSTA: 1A-AP-09, 1A-AP-10, 1A-AP-11, 1A-AP-14, 1B-AP-11, 1B-AP-12, 1B-AP-15
  • CS CA: K-2.AP.12, K-2.AP.13, K-2.AP.16, 3-5.AP.13, 3-5.AP.14, 3-5.AP.17
  • ISTE: 1.c, 1.d, 4.d, 5.c, 5.d, 7.c

U.K. Standards

National Curriculum of England (Computing)
Key Stage 3:
  • Design, use, and evaluate computational abstractions that model the state and behaviour of real-world problems and physical systems
  • Understand several key algorithms that reflect computational thinking (for example, ones for sorting and searching); use logical reasoning to compare the utility of alternative algorithms for the same problem
  • Use two or more programming languages, at least one of which is textual, to solve a variety of computational problems; make appropriate use of data structures (for example, lists, tables, or arrays); design and develop modular programs that use procedures or functions
  • Understand simple Boolean logic (for example, AND, OR, and NOT) and some of its uses in circuits and programming; understand how numbers can be represented in binary, and be able to carry out simple operations on binary numbers (for example, binary addition, and conversion between binary and decimal)
  • Understand how instructions are stored and executed within a computer system; understand how data of various types (including text, sounds, and pictures) can be represented and manipulated digitally, in the form of binary digits
Key Stage 4:
  • Develop their capability, creativity, and knowledge in computer science, digital media, and information technology
  • Develop and apply their analytic, problem-solving, design, and computational thinking skills
This course is not part of your plan. Please upgrade to view all answer keys

Class Presentations

These student-facing slide presentations help educators seamlessly run Tynker lessons in a virtual or physical classroom setting. Each lesson has its own set of slides that introduce the big ideas, suggest unplugged activities, and include a section for each activity module. While running lesson slides, you can switch back and forth between the activity, the slides, answer keys and other lesson materials.
A sample slide presentation is available for your review. Please log in to view all the class presentations available with your plan..
Lesson 1
Introduction
37 Slides
Lesson 2
Tynker Workshop
26 Slides
Lesson 3
Animation
23 Slides
Lesson 4
Storytelling
28 Slides
Lesson 5
Input Events
31 Slides
Lesson 6
Slideshow
26 Slides
Lesson 7
Character Creator
23 Slides
Lesson 8
Make a Birthday Card
25 Slides
Lesson 9
The Music Machine
26 Slides
Lesson 10
Positioning Actors
29 Slides
Lesson 11
Pen Drawing
34 Slides
Lesson 12
Keeping Score
24 Slides
Lesson 13
Adding Logic
24 Slides
Lesson 14
Quiz Game
27 Slides
Lesson 15
Color Sensing
22 Slides