Leanpub Header

Skip to main content

Python at play

The Beginner's Guide to Building Open-Source Games. Pygame, Game Design, and Real Projects You Can Share

Python at play

Go from an empty window to a published open-source platformer. Python at Play teaches you to build, polish, test, and share real games with Python and pygame-ce, one runnable project at a time.

Minimum price

$24.99

$29.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
About

About

About the Book

Every programmer remembers the first time something they wrote moved on the screen because they pressed a key. Python at Play takes that moment and keeps going, all the way to a finished, polished game that anyone in the world can download, play, and improve.

This is a hands-on guide for beginners in game development who know basic Python. You will learn by building four projects of increasing size, at a fictional indie studio called Lantern Pixel:

- Bounce Duel, a two-player paddle game that teaches the game loop, drawing, movement, input, and collisions.

- Star Courier, an arcade space game with sprites, sound, menus, scenes, and animation.

- Lantern Run, a side-scrolling platformer with tile maps, platformer physics, a smooth camera, enemy AI, particles, and dynamic lighting.

- Lantern Run as a professional open-source release, with saving, tests, automated builds, and community contributions.

What you will learn:

- Real-time programming: the game loop, delta time, vectors, and collisions

- Platformer physics that feel great: coyote time, jump buffering, and variable jumps

- Cameras, parallax scrolling, screen shake, particles, and light-and-darkness effects

- Enemy AI with state machines and path finding

- Game design: core loops, difficulty curves, level design, and playtesting

- Professional skills: safe saving, profiling, automated testing with pytest, and packaging with PyInstaller and pygbag for the web

- Open source: choosing licenses, GitHub and continuous integration, accepting contributions, publishing on itch.io, and joining game jams

What makes this book different:

- Every code listing is complete and was run to produce the output and screenshots you see in the book.

- All art, sounds, and levels come from a small CC0 script included in the book, so your game looks exactly like the screenshots, with no downloads required.

- Each chapter includes a Studio Brief, clear diagrams, Common Mistakes boxes, practical recipes, a Build It project step, a summary, and exercises.

- Appendices include a Python refresher, a pygame-ce quick reference, math for games, common errors and fixes, solutions to selected exercises, and a glossary.

By the end, you will not just know how to make games. You will know how to finish them, share them, and build them together with other people.

Requirements: basic Python (variables, loops, functions, lists, and dictionaries), Python 3.10 or later, and a computer running Windows, macOS, or Linux.

Author

About the Author

Oscar Gomez

Hi, I’m Oscar Gomez. I write practical programming books for people who want to use code to get real work done. I believe beginners learn fastest by solving real problems, not by memorizing syntax, so my books are built around workplace scenarios, hands-on projects, and the habits professionals use every day.

My goal is simple: to help you go from your first line of code to confident, job-ready skills. Thanks for reading, and welcome aboard.

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub