beanz Magazine

PyGame (or Godot)

Blake Patterson on Flickr

Dive into the nitty-gritty of game-making with this popular Python library.

In the last issue, I talked about my experience in PyWeek, a week-long game jam done specifically with Python and the PyGame library. This week, we’ll talk more about PyGame itself and give some examples of how to do things in it.

To start with, PyGame is a pretty old library but one that’s still being used and updated for a reason: it’s an easy way to write your own game engines in Python.

If you’re not sure what I mean by “game engine” I mean a lot of the real guts of a game. A game engine is the code for things like physics, motion controls, or handling keypresses, mouse movement, and using a controller.

I think of games writing as being on a spectrum: on one end you have things like GameMaker where you don’t necessarily need to do programming to make a game. On the other end you could write all the code to:

  • Talk to the graphics hardware to be able to put colors in specific pixels
  • Load images from files and turn it into something that can be displayed on the screen
  • Ask the operating system for keyboard/mouse/controller inputs
  • Handle refreshing the screen many times a second

Most ways of writing games are in the middle. Things like Unity and Godot are more towards the GameMaker end; meanwhile, something like PyGame is closer to the full DIY way of making games.

Become a subscriber and get access to the rest of this article. Plus all our magazine articles.

Stories also include numerous links to help parents, kids, and teachers learn more. Get access today at just $15 per year for online magazine only or $29.99/year for print + online ($35/year outside US)!

Subscribe Today!

Also In The April 2018 Issue

Logic puzzles help develop reasoning skills useful for programming, computer science, and anything you might do.

Find perfect and fun gifts for your loved ones that teach STEAM concepts and skills.

From light-up bow-ties to conductive thread, you’ll be the life of the party with this STEAM-inspired gear.

A free online test service reveals how much personal data your web browser is giving away.

Add more tools to your command line arsenal, including running mini-scripts and making backup copies.

Use switches to take your robotic creations to the next level.

An old classic with a electronic twist, featuring JavaScript and micro:bit.

Create the American flag in SketchUp using this detailed tutorial.

From lasers to supernovas, Berboucha is making science communication a priority.

Code can always be improved. Check out these tips to make you the best programmer you can be!

It’s a programming language unlike any you’ve seen before. Check out this symbolic system designed for mathematical calculations.

New, improved, faster, and sleeker - it’s Scratch 3, your new favourite block language!

Learn about the brilliant algorithm behind all of your GPS devices.

It’s free, comprehensive, and available on-the-go. This cool app helps you master Python faster than ever before.

Open up whole new worlds to explore through these interesting, diverse add-ons.

Links from the bottom of all the October 2018 articles, collected in one place for you to print, share, or bookmark.

Interesting stories about computer science, software programming, and technology for October 2018.