Make a 2D Side-Scroller Game With PyGame

In this course, you’ll learn about creating games using Python and the library PyGame.

By the end of this course, you’ll be able to:

  • Draw items on your screen
  • Play sound effects and music
  • Handle user input
  • Implement event loops
  • Describe how game programming differs from standard procedural Python programming

This primer assumes you have a basic understanding of writing Python programs, including user-defined functions, imports, loops, and conditionals. You should also be familiar with how to open files on your platform. A basic understanding of object-oriented Python is helpful as well. pygame works with most versions of Python, but Python 3.6 is recommended and used throughout this article.

About Christopher Bailey

Christopher Bailey Christopher Bailey

Chris is an avid Pythonista and creates video tutorials for Real Python. He is a programmer and data analyst. He creates music under the name Tripnet. Chris lives in Colorado with his wife and two dogs.

» More about Christopher

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

Participant Comments

mikesult on May 4, 2020

Thanks Chris, Excellent course. You covered so many of the elements in a nice incremental way and always kept a working program at all stages.

One strange behavior for me was when loading the sprite images of the jet and missile, if I used the .convert() method then the .set_colorkey() method on the next line didn’t create the desired transparency. If I removed the .convert() method then the .set_colorkey() method did work. The cloud sprite worked fine when using the .convert() method. Very strange.

I learned a lot, thanks!

David Wright on April 26, 2020

Thank you Chris for a great course. I think I have found what I want to do with my Python knowledge.

sumakolurmath on March 27, 2020

Thanks Chris, for the awesome course!

« Browse All Courses