Lesson 22: Project - Design a Game


Students will plan and build their own game using the project guide from the previous two lessons to guide their project. Working individually or in pairs, students will first decide on the type of game they'd like to build, taking as inspiration a set of sample games. They will then complete a blank project guide where they will describe the game's behavior and scope out the variables, sprites, and functions they'll need to build. In Code Studio, a series of levels prompts them on a general sequence they can use to implement this plan. Partway through the process, students will share their projects for peer review and will incorporate feedback as they finish their game. At the end of the lesson, students will share their completed games with their classmates. This project will span multiple classes and can easily take anywhere from 3-5 class periods.


This lesson is the culmination of Unit 3 and provides students an opportunity to build a Game Lab project of their own from the ground up. The scaffolding provided by the project guide and the practice they have using it are intended to assist students in scoping their projects and seeing their ideas through to completion. This project is an opportunity to showcase technical skills, but they will also need to collaborate with their partner, provide constructive peer feedback, and repeatedly use the problem solving process as they encounter obstacles along the way. This project should be student-directed whenever possible, and provide an empowering and memorable conclusion to the first unit of CS Discoveries.


Warm Up (10 mins)

Activity (80-200 mins)

Wrap Up (10 mins)

View on Code Studio


Students will be able to:

  • Independently scope the features of a piece of software
  • Create a plan for building a piece of software by describing its major components
  • Implement a plan for creating a piece of software



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

For the Students

Teaching Guide

Warm Up (10 mins)

Review Project Guide

Group: This project can be completed individually or in pairs. At your discretion you may choose to have students form larger groups as well.

Distribute: Each student or group of students should be given a copy of Make Your Own Game - Project Guide. As a class review the different steps of the project and where they appear in the project guide. Direct students towards the rubric so that they know from the beginning what components of the project you will be looking for.

Activity (80-200 mins)

Define - Scope Game

Circulate: Students should spend the first 15-20 minutes playing the sample games, reviewing past work, and discussing as a group the type of game they'd like to build. If they want they can sketch ideas on scratch paper or in

Prepare - Complete Project Guide

Circulate: Once students have discussed their ideas for the project they should complete the Make Your Own Game - Project Guide. While this should be a fairly familiar process, encourage students to make each component as clear and detailed as they can at this point. Planning ahead can help them identify issues in their plan before they'll need to make more significant changes to their code.

Try - Write Code

Transition: Students are now ready to program their games on Code Studio. These levels provide some guidance on how students may go about implementing their Make Your Own Game - Project Guide. None of the steps are significantly different from what students have seen from the previous two lessons. If they wish, students can work in a different order than the one suggested in these levels.

Reflect - Peer Review

Distribute: Give each student a copy of Make Your Own Game - Peer Review.

Students should spend 15 minutes reviewing the other group's game and filling out the peer review guide.

Iterate - Update Code

Circulate: Students should complete the peer review guide's back side where they decide how to respond to the feedback they were given. They should then use that feedback to improve their game.

Wrap Up (10 mins)


Share: Give students a chance to share their games. If you choose to let students do a more formal presentation of their projects the project guide provides students a set of components to include in their presentations including:

  • The original game they set out to build
  • A description of the programming process including at least one challenge they faced and one new feature they decided to add
  • A description of the most interesting or complex piece of code they wrote
  • A live demonstration of the actual game


Send students to Code Studio to complete their reflection on their attitudes toward computer science. Although their answers are anonymous, the aggregated data will be available to you once at least five students have completed the survey.

View on Code Studio

Create your own game

Now that you have all the skills you need, it's time to make your own game!

With a partner, brainstorm some different ideas for your game. You can think about the games you've already seen, or look at some more sample games to give you ideas.

Once you have settled on a type of game with your partner, fill out the Project Guide with the backgrounds, variables, sprites, and functions that you will need to make the game. You'll spend the next few levels creating your game.

  • Project - Background and Variables
  • 3
  • 4
  • 5
  • 6
  • (click tabs to see student view)
View on Code Studio

Student Instructions

Create your Variables

First, you'll need to create all of your variables and put them in the variables area of your code. Show me the block Show me the area in the code

Don't forget, each variable needs a label (name) and a starting value. You can change the value of the variable later in your code.

View on Code Studio

Student Instructions

Create your Backgrounds

Next, you'll create all of the background functions that you need for your game. Some games only have one background, and others have more than one that's chosen according to user score or another aspect of gameplay. You'll need to create a function for each separate background in your game. You'll write the code to choose the correct background in the next level.

After you create your functions, test them by calling them inside the draw loop, one background per test.

View on Code Studio

Student Instructions

Display Boards

Now that your backgrounds are working, you can add your display boards. Most games have a score board, but you might also want to display information about player level or lives remaining. Look at Lesson 12 Puzzle 9 for an example of how to make a scoreboard.

For each display board: Create a function to display the information Call the function in the draw loop

Be sure to test your boards by changing the starting value of your variables and making sure the board also changes when you run the code.

View on Code Studio

Student Instructions

Choose your Backgrounds

Now that you have the backgrounds that you need, you'll write the code to choose the correct background. You've seen this done in Lesson 15 Level 11.

After you've written the code, test it by changing the starting value of your variables and making sure the correct background shows up.

View on Code Studio

Student Instructions

Create your Animations

Next you will create your animations in the animation tab. Don't forget to make multiple animations if you want your sprite to change appearance according to how it's moving.

View on Code Studio

Student Instructions

Create your Sprites

Next you will create your sprites and give them starting properties in the "Create Sprites" area of your code. For each sprite your should:

  • Create the sprite in the correct place on the screen
  • Set its animation (or color and size)
  • Set its velocity and rotation speed, if needed
  • Set its collider and bounciness, if needed

After you create each sprite, test it before making the next one. If your sprite starts off screen, first place it on the screen to test it, them move it back off screen once you know that it looks right.

If your sprites position will need to be reset later in your game, it's a good idea to make a function that sets the position of this sprite that you can use again later.

View on Code Studio

Student Instructions

Sprite Movement Functions

Now you'll make the functions that make the sprite move in different ways as the game is played. Some examples of functions that you've written are loopPlatforms in Lesson 17 Puzzle 9 and playerFall in Lesson 17 Puzzle 14.

For each movement: Create a function that will make the sprite move in that way Call the function inside the draw loop

View on Code Studio

Student Instructions

User Controls

Next, you'll want to make sure your user controls are working. Create a function that makes your sprites respond to user controls as defined in your project guide. You can use the function in in Lesson 20 Puzzle 13 as an example.

View on Code Studio

Student Instructions

Sprite Interactions

The last step is to create the functions that make your sprites interact in the right ways. You'll need a function for each type of sprite interaction. You can use the collectItems in Lesson 21 Puzzle 17 and displaceEnemies in Lesson 20 Puzzle 15 as examples.

For each interaction: Create a function in the functions area of your code Call the function inside the draw loop

After you make each function, run the code to test it before making another.

View on Code Studio

Finishing Touches

Now that you have the basis for your game, it's time to add some finishing touches.

To make your game even better, try making at least two improvements to it. You can use the list below to help you, or you can come up with your own improvements that you'd like to make.

  • Find a way to keep your player from going off the edges of the screen.
  • Add a different item for your player to collect or avoid that are worth different point values.
  • Make a variable to keep track of how many lives your player has, and then end the game when the lives run out.
  • Add sprites that move in the background of your game.
  • Make another background to switch to when the score gets even higher, or when the game ends.
  • Give your game a way to end. Possible events to end your game could be the score reaching a certain value, or the amount of lives to keep the game running runs out.
  • If your game has platforms, try making the objects in your game interact with these platforms in some way.
  • Reflection
  • 13
  • (click tabs to see student view)
View on Code Studio

Student Instructions

This level is an assessment or survey with multiple questions. To view this level click the "View on Code Studio" link.

Standards Alignment

View full course alignment

CSTA K-12 Computer Science Standards (2017)

AP - Algorithms & Programming
  • 2-AP-10 - Use flowcharts and/or pseudocode to address complex problems as algorithms.
  • 2-AP-11 - Create clearly named variables that represent different data types and perform operations on their values.
  • 2-AP-12 - Design and iteratively develop programs that combine control structures, including nested loops and compound conditionals.
  • 2-AP-13 - Decompose problems and subproblems into parts to facilitate the design, implementation, and review of programs.
  • 2-AP-15 - Seek and incorporate feedback from team members and users to refine a solution that meets user needs.
  • 2-AP-16 - Incorporate existing code, media, and libraries into original programs, and give attribution.
  • 2-AP-17 - Systematically test and refine programs using a range of test cases.
  • 2-AP-18 - Distribute tasks and maintain a project timeline when collaboratively developing computational artifacts.
  • 2-AP-19 - Document programs in order to make them easier to follow, test, and debug.