Welcome to Python Game Design! You and your students will be coding your very own Cookie Clicker game with the Python programming language and computer science skills. Direct your students to the Cookie Clicker project!
Guide your students into creating their Repl.it accounts (or help signing in if they already have one). They may need to verify their accounts in their emails. Once they have them set up, they can share their progress with you.
Introduce the Repl.it tools and interface inSetting Up Repl.it.
Check for understanding on how to type the symbols in theKeyboard Guide.
If you'd like, you can print out ourPython cheat sheetand distribute to your students for their reference. This is also found in their Welcome to Python Game Design! section.
Review the section vocabulary below.
Code: Instructions that tells a computer or computer program what to do.
Verify: To prove.
Interface: The area where a user can interact with the computer, usually by clicking or typing.
Syntax: The format, or way, code typed. Syntax is different for different languages.
This section is for getting started with Repl.it accounts. Familiarize yourself with the platform and identify the parts of the interface as found in the Setting Up Repl.itsection.
Python is a programming language used throughout the world. People like Python because of its ease of use and its power. We will use Python to create games that you can actually play and enjoy!
What is PyGame?
PyGame is the name of the package that we will be using to make our games! A package is a collection of files that have already been created for us that we can use to make our projects easier and faster. This package will allow us to create graphics like sprites and backgrounds and even allow us to program motion! The package lets us do this much quicker than if we were to create all the code by ourselves!
Here’s a quick guide forPython syntax (how to code in the Python language). You may find this helpful as you program your project.
You can always reference this sheet if you get lost or forget something! You can also download and print it out by clickingHERE.
Now you’re ready to code! Open a new tab or window to follow along with our myBetabox videos. Then, click on the next section to start!
Setting Up Repl.it with Pygame
The first step to coding on Repl.it is creating a newrepl, which stands for…
Read (computer reads the code you typed)
Evaluate (runs the code)
Print (shows the results)
Loop (does R, E, and P in a loop)
Think of it repls like coding projects. You should notice a button on the top right that says ‘+ new repl.’
When you click this button, you will be asked what programminglanguageyou want to use. For this game we will be usingPygameinstead of Python. Make sure to select Pygame when you create your project!
Now that our repl has been created we can see the coding interface. The far left of the screen is our file directory and will tell us what files and folders are in our project.
The middle section is our workspace where we will type our code…
…and the far right section is where we will see our code when we click run!
The other important part of this screen is the share button. This button will allow you to share your code with others in case you get stuck!
Here are some handy guides for coding symbols. Hold the keys with a circle down at the same time.