We may earn an affiliate commission when you visit our partners.
Course image
Penny de Byl and Penny Holistic3D

What makes games fun? Game mechanics. What makes learning a new programming language fun? Creating games with it. This course allows you to do both.  If you've ever wanted to take your programming skills further and get into Python, then this is your opportunity.  If you already know Python but want to know how to use it to create games, then this course is also for you.

Designed for

You will learn about:

Read more

What makes games fun? Game mechanics. What makes learning a new programming language fun? Creating games with it. This course allows you to do both.  If you've ever wanted to take your programming skills further and get into Python, then this is your opportunity.  If you already know Python but want to know how to use it to create games, then this course is also for you.

Designed for

You will learn about:

  • The Pycharm Development Environment.

  • The Pygame API, which is an interface for OpenGL and DirectX.

  • The use of screen coordinates to place, size, move, animate, and restrict game characters.

  • Constructing a main game loop.

  • Working with Static and Animated Sprites.

  • Sprite Collision Detection.

What people are saying about Penny's courses:

  • Dr. Penny is a wonderful person and a true expert. All of her courses I've taken have been top notch and in my opinion there is no better teacher out there.

  • Allow me to say how hugely important this is for a person who is interested in certain types of game design. Creating games where you can create AI behaviors that support emergent situations.

  • I honestly love Holistic's teaching approach and I've never learned so much within a few hours about coding effectively with such detailed explanations.

This course focuses on providing students with hands-on experience coding game mechanics, while also providing an easy introduction to Python for the intermediate programmer.

Enroll now

What's inside

Syllabus

By the end of this section students will understand what content is in the course and how to get help.

In this lecture Penny will welcome students to the course and give an overview of the content.

Read more

H3D has a bustling online student community.  Here's how to get involved.

How to contact us

Description: Important Reading on Common Issues students have and how to ask for help.

In this lecture students will learn about some differing types of game mechanics and how they are used in games to create gameplay.

In this lecture students will learn how to download and install Python and Pycharm.

In this lecture students will learn how to construct a simple main game loop to keep the graphics window open until the player clicks on quit.

In this lecture students will learn how to display an align a sprite inside a window.

In this lecture students will learn how to resize a sprite and also dynamically adjust the position of it on the screen.

In this lecture students will learn how to move a sprite around on the screen with the arrow keys.

In this lecture students will learn how to control the frames per second a loop runs at as well as how to clear a frame of previous drawings.

In this lecture students will learn how to restrict the movement of a sprite by calculating where the sprite will hit the edge of the screen.

In this lecture students will learn how to use the mouse to move sprites around on the screen.

In this lecture students will learn how to draw a rectangle on the screen to use as a button.

In this lecture students will learn to position text on the button and program it to quit the window when clicked on.

In this lecture students will learn how to program the button to change colours on a mouse over.

In this lecture students will begin setting up the window and resources for a brick breaking game.

In this lecture students will learn how to dynamically place bricks into a grid based on the window size.

In this lecture students will be challenged to integrate previously acquired knowledge to move the bat back and forth across with screen with the arrow keys.

In this lecture students will add a ball to the game that bounces off the edges of the screen.

In this lecture students will learn how to determine when the ball collides with the bat and get the ball to change direction.

In this lecture students will learn how to determine when the ball hits a brick, how to remove the brick from the screen and how to make the ball change direction when it hits a brick.

In this lecture students will setup the basic window and a grid for a game of Tetris and learn how to draw rectangles with borders and create functions in python.

In this lecture students will learn how to create and store the data for different block types.

In this lecture students will learn how to display a block over the top of the grid and align it with the grid size.

In this lecture students will learn how to make a block drop down the grid and how to stop it when it hits the bottom.

In this lecture students will learn how to move the block from side to side and restrict it's movement when it reaches the side of the screen.

In this lecture students will learn how to create a game board to store all the blocks as they hit the bottom of the screen.

In this lecture students will learn how to use the python random library to set random starting positions for blocks as well as block types.

In this lecture students will learn how to rotate a shape as well as test if the shape can be rotated without going off the grid.

In this lecture students will learn how to test for a wide range of block collisions in the one function and then integrate it with the rest of the code.

In this lecture students will learn how to give the blocks random colours.

In this lecture students will learn how to remove any lines that contain all blocks and keep score.

In this lecture students will learn how to display a score on the screen using fonts and text.

In this lecture students will add game over text to the screen when the grid fills up with blocks.

In this lecture students will begin a new asteroid game project and put together the basic elements of the window and display a ship and asteroid.

In this lecture students will learn how to program the space ship player character to move about on the screen.

In this lecture students will learn how to move the asteroids and rebound them from the edges of the screen.

In this lecture students will learn how to create a bullet class and link it to the rotation of the ship so the bullets emanate from the ship and travel in the direction the ship is facing.

In this lecture students will learn how to create a timed cool down period that can stop the player taking actions.

In this lecture students will learn how to add momentum to the movement of the ship so that it continues to drift across the screen even when the player isn't moving it.

In this lecture students will learn how to wrap the position of the ship and asteroid around the edges of the screen so that an object going off one side appears back on the opposite side.

In this lecture students will learn how to determine when a bullet hits an asteroid by writing a simple collision detection function.

In this lecture students will learn how to destroy the ship when it hits an asteroid.

In this lecture students will learn how to add sound effects into their game.

In this lecture students will learn how to setup messages for the winning and losing conditions.

In this lecture students will learn how to split the asteroids into smaller parts when they are hit by a bullet.

In this lecture students will learn how to make modules in python and link them up to call functions between them.

In this lecture students will learn how to make a scene that is being shown on the screen something that is passed to a main scene generating class.

In this lecture students will create the basic game play scene with a back button that will return them to the main menu.

In this lecture students will construct the class to contain the player character and program it to move the player icon left and right across the screen.

In this lecture students will add the first alien character to the screen from the sprite sheet.

In this lecture students will learn how to place a grid of aliens on the screen and offset the grid from the top left hand corner.

In this lecture students will learn how to move the grid of aliens back and forth across the screen and move them down each time and edge is reached.

In this lecture students will learn how to change the frame being drawn for a sprite in order to animated it.

In this lecture students will be challenged to add the bullets so the player can shoot at the aliens.

In this lecture students will learn how to use a sprite collider to determine when bullets hit the aliens.

In this lecture students will learn how to add an animated sprite sheet to their game to show an explosions when alien's are destroyed.

In this lecture students will learn how to add extra bullets for the aliens to shoot and how to keep track of the number of lives a player has left.

In this lecture students will learn how to determine the game over scenarios and reset the game for new game play.

In this lecture Penny gives you some final words about the content.

Description: This link provides further information on the courses you can look at taking based on your interests and skill level.

Traffic lights

Read about what's good
what should give you pause
and possible dealbreakers
Uses Pygame, a popular Python library, which simplifies the development of 2D games and multimedia applications, making it easier to implement game mechanics
Focuses on hands-on coding of game mechanics, providing practical experience that reinforces learning and builds a portfolio of game projects
Covers a range of classic game mechanics from games like Breakout, Tetris, Asteroids and Space Invaders, offering a broad understanding of game design principles
Requires learners to download and install both Python and PyCharm, which may require learners to upgrade their operating systems or hardware
Uses Pycharm, which is a professional IDE, so learners may need to familiarize themselves with its interface and features to effectively follow along

Save this course

Create your own learning path. Save this course to your list so you can find it easily later.
Save

Reviews summary

Python game mechanics with pygame

According to learners, this course provides a practical, project-based introduction to game mechanics using Python and the Pygame library. Many found it a great way to learn Pygame and build fundamental 2D game concepts through hands-on coding examples like Breakout and Tetris. The instructor's explanations were often highlighted as clear and effective for beginners. Some students noted that while suitable for intermediate programmers, having basic Python familiarity is helpful. The initial setup or occasional library updates might require minor troubleshooting, but overall, it offers a solid foundation for exploring game development.
Instructor explains concepts effectively.
"Dr. Penny is a wonderful person and a true expert. All of her courses I've taken have been top notch and in my opinion there is no better teacher out there."
"I honestly love Holistic's teaching approach and I've never learned so much within a few hours about coding effectively with such detailed explanations."
"Explanations were generally clear and easy to follow, especially for someone getting started."
"The instructor broke down complex ideas into manageable parts."
Effective for learning the Pygame library basics.
"This course was a perfect introduction to Pygame for someone who knew a little Python."
"I now feel comfortable starting my own small projects using Pygame after taking this."
"The way Pygame is explained here makes it accessible even if you're new to game libraries."
"Learned a lot about using Pygame for basic graphics, sprites, and loops."
Hands-on coding with classic game projects.
"Building the Breakout and Tetris examples was the most helpful part for understanding the mechanics."
"I really enjoyed coding the games like Space Invaders step-by-step; it made concepts stick."
"Working through practical projects like Asteroids gave me tangible skills I can use."
"The hands-on coding and projects are the strongest part of the course for me."
Initial environment setup can be challenging.
"Getting Pygame and Pycharm set up correctly took a bit of troubleshooting."
"Had some minor issues during the installation and setup phase."
"Follow the setup instructions carefully, it wasn't totally smooth for me."
"Sometimes library versions can cause small hiccups during initial setup."
Requires some basic Python background.
"While it says for intermediate, I think a solid understanding of Python fundamentals is pretty necessary."
"Might be challenging if you are completely new to programming; a bit more Python prep helps."
"The pace is good if you know Python, but could be fast if you're learning both at once."
"Assumes you know Python syntax and basic structures before starting."

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Exploring Game Mechanics with Python by Example with these activities:
Review Python Fundamentals
Strengthen your understanding of Python syntax and data structures before diving into game development with Pygame. This will make it easier to grasp the game mechanics concepts.
Browse courses on Python Basics
Show steps
  • Review basic Python syntax and data structures.
  • Practice writing simple Python programs.
  • Complete online Python tutorials.
Review 'Python Crash Course'
Solidify your Python knowledge with a comprehensive guide that covers the fundamentals and provides practical examples.
Show steps
  • Read the first half of the book covering Python basics.
  • Work through the example projects in the book.
Simple Pygame Project: Bouncing Ball
Practice using Pygame to create a simple game with a bouncing ball. This will help you understand the basics of game loops, sprite movement, and collision detection.
Show steps
  • Set up a Pygame window and draw a ball sprite.
  • Implement movement for the ball.
  • Add collision detection with the window edges.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Document Your Game Development Journey
Create a blog or journal to document your progress, challenges, and solutions while learning game mechanics with Python. This will help you reflect on your learning and solidify your understanding.
Show steps
  • Create a blog or journal.
  • Write about your experiences with each game mechanic.
  • Share your code and explain your approach.
Follow Pygame Tutorials
Explore online tutorials that cover specific Pygame features or game mechanics. This will help you learn new techniques and expand your knowledge.
Show steps
  • Find Pygame tutorials online.
  • Follow the tutorials step-by-step.
  • Adapt the tutorials to your own projects.
Contribute to a Pygame Project
Contribute to an open-source Pygame project to gain experience working with a larger codebase and collaborating with other developers. This will help you improve your coding skills and learn best practices.
Show steps
  • Find an open-source Pygame project on GitHub.
  • Read the project's documentation and contribution guidelines.
  • Identify a bug or feature to work on.
  • Submit a pull request with your changes.
Expand on Course Projects
Take the games developed in the course and add new features, mechanics, or levels. This will help you solidify your understanding and explore your creativity.
Show steps
  • Choose a game from the course.
  • Brainstorm new features or mechanics.
  • Implement your ideas and test them thoroughly.

Career center

Learners who complete Exploring Game Mechanics with Python by Example will develop knowledge and skills that may be useful to these careers:
Game Programmer
A game programmer translates design ideas into functional code, creating the interactive elements that define a video game. This course directly aligns with the core responsibilities of a game programmer, specifically relating to game mechanics. The course provides hands-on experience creating game mechanics using Python and Pygame, an interface for OpenGL and DirectX, while exploring concepts like sprite manipulation, collision detection, and game loops. Through building games such as Breakout, Tetris, Asteroids, and Space Invaders, learners gain practical skills directly applicable to game programming tasks. Anyone interested in game programming would benefit from this course.
Game Designer
Game designers conceptualize and design the core elements of a video game, including its mechanics, rules, and overall player experience. This course directly aligns with the responsibilities of a game designer, focusing specifically on game mechanics. The course provides hands-on experience creating game mechanics using Python and Pygame, exploring concepts like sprite manipulation, collision detection, and game loops. By building games such as Breakout, Tetris, Asteroids, and Space Invaders, learners gain practical insights into how game mechanics function and how they can be implemented. Those who want to be game designers should take this course.
Python Developer
Python developers are programmers who specialize in using the Python programming language to build software applications. This course directly aligns with the skills needed to be a Python developer, focusing on applying Python in the context of game development. The course provides hands-on experience creating various game mechanics using Python and the Pygame API, solidifying understanding of fundamental Python concepts. The course helps python developers explore libraries, learn to interact with different APIs, and translate abstract concepts into concrete and tangible gaming experiences. This can be helpful for any Python developer.
Indie Game Developer
An indie game developer works independently or within a small team to create and publish games. This course provides a comprehensive foundation for indie game development, especially for individuals who want to create 2D games with Python. The course covers the Pygame API, sprite manipulation, collision detection, and writing game loops. By building games such as Breakout, Tetris, Asteroids, and Space Invaders, learners get the necessary skills to start their own game projects. This course may be useful for people who would like to be indie game developers.
Gameplay Engineer
A gameplay engineer specializes in implementing and refining the interactive elements of a game, focusing on how the player interacts with the game world. This course may be useful because it focuses on coding game mechanics. Through example projects like Breakout, Tetris, Asteroids, and Space Invaders, learners gain experience designing and implementing engaging interactions. The course content involves learning about the Pygame API, screen coordinates, implementing sprite movements and collisions, constructing a main game loop, and much more. The hands-on experience creating these games helps gameplay engineers develop the skills needed to implement and refine the game mechanics in their projects. This course may be useful for anyone hoping to become a gameplay engineer.
Software Engineer
Software engineers apply engineering principles to design, develop, maintain, test, and evaluate software. This course may be helpful for software engineers because it offers practical experience in software design through game development. The course emphasizes the use of Python and the Pygame API. Students work through example projects, covering topics such as sprite animation, collision detection, and game loop construction. The hands-on approach will give software engineers a good starting point for learning the practical aspects of game development, which can be valuable for understanding software design principles. This course may be useful for software engineers who are starting out.
Game Development Educator
A game development educator teaches game design and development principles to students in academic or vocational settings. This course may be useful for a game development educator because it provides a structured approach to teaching game mechanics using Python. The course's hands-on projects, such as Breakout, Tetris, Asteroids, and Space Invaders, offer practical examples that can be incorporated into lesson plans. This course helps game development educators to develop engaging and effective teaching materials. People who plan to be educators in the game development field may find this course useful.
Serious Game Developer
Serious game developers create games for purposes beyond pure entertainment, such as education, training, or healthcare. The course may be useful for a serious game developer, because it provides a foundation in game mechanics and Python programming. The course focuses on game design and implementation, and delves into collision detection and writing game loops. By working through projects like Breakout, Tetris, Asteroids, and Space Invaders, students gain insights into the fundamental concepts of the game development process. Serious game developers looking to broaden their skillset may find this course useful.
Tools Programmer
A tools programmer develops software to assist game developers in their workflow, such as level editors, asset management systems, or debugging tools. This course may be useful for tools programmers, because it provides a foundational understanding of game development concepts, allowing them to create tools that better integrate with the game development process. Understanding how game mechanics are implemented, as taught in the course, can inform the design of effective tools. Tools programmers who are new to game development may find this course useful.
Mobile Game Developer
Mobile game developers create games for smartphones and tablets, optimizing them for mobile platforms. This course provides a foundation in game mechanics and Python programming, and may be useful as a starting point for mobile game development. The course focuses on game design and implementation, delving into implementing collision detection, and constructing game loops. By working through projects like Breakout, Tetris, Asteroids, and Space Invaders, students gain insights into the fundamental concepts of the game development process. Mobile game developers looking to broaden their toolkit may find this course useful.
AI Programmer
An AI programmer focuses on developing artificial intelligence for games, including character behavior, decision-making, and pathfinding. While this course primarily focuses on game mechanics, it may be useful for AI programmers, because it provides a practical understanding of how game systems are structured and how AI can interact with them. The ability to manipulate sprites, detect collisions, and manage game loops, as taught in the course, is valuable for implementing AI behaviors. AI programmers who are new to game development may find this course useful.
Augmented Reality Developer
Augmented reality developers create interactive experiences that overlay digital content onto the real world. While this course does not directly focus on AR, it may be useful for AR developers because it teaches the fundamentals of game development, with a focus on game mechanics using Python through example projects. The course uses the Pygame API which is an interface for OpenGL and DirectX, further building a foundation in graphics programming concepts applicable to AR. Augmented reality developers looking to expand their skills in game design may find this course useful.
Virtual Reality Developer
Virtual reality developers create immersive experiences for VR platforms. While this course does not directly focus on VR, it may be useful for a VR developer because it teaches the fundamentals of game development with a focus on game mechanics using Python through example projects. The course uses the Pygame API which is an interface for OpenGL and DirectX, further building a foundation in graphics programming concepts applicable to VR. VR developers seeking to expand their skills in game design may find this course useful.
Software Developer
Software developers design, develop, and test software applications. While this is a course on game design, it may be useful for software developers since it allows them to practice coding and problem-solving skills using Python. The course provides practical experience with Python while developing game applications. This course provides hands-on experience by guiding students through games such as Breakout, Tetris, Asteroids, and Space Invaders. Software developers looking to enhance their skills with a new language may find this course useful.
Simulation Developer
Simulation developers create software that models real-world systems or processes for training, research, or entertainment purposes. This course may be useful for simulation developers, because it offers hands-on experience in developing interactive systems using Python. The course specifically focuses on game mechanics, which can be applied to designing interactive simulations. The course's emphasis on the Pygame API, sprite manipulation, and collision detection will help simulation developers create engaging and realistic simulations. Simulation developers who are new to game programming may find this course useful.

Featured in The Course Notes

This course is mentioned in our blog, The Course Notes. Read one article that features Exploring Game Mechanics with Python by Example:

Reading list

We've selected one books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Exploring Game Mechanics with Python by Example.
Provides a solid foundation in Python programming, covering essential concepts and syntax. It's particularly useful for beginners or those looking to refresh their Python skills before tackling game development. The project-based approach aligns well with the course's focus on creating games, making it a valuable resource for hands-on learning. It is commonly used as a textbook at academic institutions.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Similar courses are unavailable at this time. Please try again later.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser