Building the Application

Here, we’re going to start building the application specified above. Let’s start with creating a window.

So you can understand the process of building the game, I’m going to go through it step by step. I have included the source code in the Ch11 folder so you can study the code and execute it using the python interpreter.

Let’s begin...

Initialise and Create Window

The first thing we’re going to build is the user interface. Have a look at project01.py

Import the necessary Pygame module, then initializes.

import pygame

pygame.init()

Create a game window 800x600 pixels and set the window title.

screen = pygame.display.set_mode((800, 600))

pygame.display.set_caption(“My Invaders”)

Load the background image and assign to ...

Get Python Made Easy now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.