Leanpub Header

Skip to main content

Python Game Development

Create your First Game with Python

A fun and Easy way to Develop your Games using PyGame and Python !!!

The author is letting you choose the price you pay for this book!

Pick Your Price...
PDF
EPUB
WEB
169
Pages
About

About

About the Book

Python Game Development with PyGame is a programming book that covers the Pygame game library for the Python programming language.

Each chapter gives you the complete source code for the game and it builds upon the previous chapter, teaching the programming concepts from these examples.

You will start by understanding how to create a basic game in Python and then move to build your game from the most basic elements increasing the level of complexity on each chapter.

The book is designed to be an introductory guide so you can build your first prototype as quick as possible, you will build and understand all the concepts in around 160 pages so shouldn't take you long to bring your game to life.

  • Build a basic game framework.
  • Add characters (Player & NPCs).
  • Implement gravity.
  • Create objects like platforms.
  • Design a basic UI with player score.
  • Make your game vibrant with sounds.

Hope you enjoy this one !!

Check out other books from the author:

Learning Python Programming from Scratch

Python and Django Web Developer

Programming in Golang

Javascript Snippets

Appwrite Up and Running

Front End Developer Interview Questions

VueJS Documentation

DevOPs

Data Science Workflow for Beginners

Price

Pick Your Price...

Minimum price

$7.99

$9.99

You pay

$9.99

Author earns

$7.99
$

All prices are in US $. You can pay in US $ or in your local currency when you check out.

EU customers: prices exclude VAT, which is added during checkout.

...Or Buy With Credits!

Number of credits (Minimum 1)

1
The author will earn $12.00 from your purchase!
You can get credits monthly with a Reader Membership

Author

About the Author

A.J. García

I started my coding career back in 2003. Lately I've been involved a lot in Javascript for frontend and the backend.

I would love passing along to you some of the experiences and challenges I've faced over the years.

Contents

Table of Contents

Other Books by Alejandro

  1. Recommended Resources

Introduction

  1. Who is this book for ?
  2. What this book covers ?

Chapter 1: Learning Python by building a simple game

  1. Installing Python
  2. Running an IDE
  3. Telling Python what to do
  4. Advanced turtle
  5. Learning Python by making a game

Chapter 2: Use the Pygame Module to build a Game Framework

  1. Getting started with Pygame
  2. Setting up your first Pygame script
  3. Code sections
  4. Setting the background
  5. Look out for errors
  6. Running the game
  7. Looping
  8. Freeze your Python environment
  9. Code

Chapter 3: Adding a Player to your Python Game

  1. Create a Python class
  2. Bring the player into the game world
  3. Setting the alpha channel
  4. Setting your own alpha

Chapter 4: Move your Character around using PyGame

  1. Setting up keys for controlling your player sprite
  2. Coding the player movement function
  3. Updating the sprite graphic
  4. Flipping your sprite
  5. All the code used so far

Chapter 5: Adding a villain to your PyGame

  1. Creating the enemy sprite
  2. Spawning an enemy
  3. Drawing a sprite on screen
  4. Level one
  5. Hitting the enemy
  6. Moving the enemy

Chapter 6: Adding Platforms to your PyGame

  1. Coding platform objects
  2. Types of platforms
  3. Level mapping
  4. Coordinates
  5. Image sizes
  6. Platform blocks
  7. Tiled platforms
  8. Applying what you know

Chapter 7: Adding Gravity to your PyGame

  1. Adding a gravity function
  2. Adding a floor to gravity

Chapter 8: Add Jumping to your PyGame

  1. Setting jump state variables
  2. Conditional gravity
  3. Programming solid ground
  4. Jumping in Pygame
  5. Calling the jump function
  6. Landing on a platform
  7. Falling

Chapter 9: Running Forward and Backward in your PyGame

  1. Putting the scroll in side-scroller
  2. Enemy scroll

Chapter 10: Putting some loot in your game

  1. Creating the loot function
  2. Scrolling loot
  3. Detecting collisions
  4. Applying what you know

Chapter 11: Adding Score to your game

  1. Displaying the score in Pygame
  2. Read the docs
  3. Deciphering technical documentation
  4. Using a font in Pygame
  5. Asset management
  6. Using a font in Pygame
  7. Displaying text in Pygame
  8. Interpreting errors
  9. Running the game
  10. Fixing the health counter
  11. Level up

Chapter 12: Add throwing mechanics to the game

  1. Create the throwable class
  2. Measure time to live
  3. Set up your throwable object
  4. Get throwing in the main loop
  5. Detect collisions
  6. Change the throw mechanic direction

Chapter 13: Adding sound to the game

  1. Start the mixer
  2. Define the sounds
  3. Add sound to Pygame
  4. Trigger a sound
  5. Add background music
  6. Enjoy the soundscapes

Keep developing your Python skills

About the Author

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

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.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

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 $14 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