Louëlla Creemers

Level Up with Python: Building a Shooter Game Live with PyGame

Struggling with abstract concepts? Make loops, conditions, and OOP tangible by building a 2D shooter game from scratch with Python.

Level Up with Python: Building a Shooter Game Live with PyGame
#1about 4 minutes

Why PyGame is a great starting point for developers

PyGame provides a visual and accessible way to learn core programming concepts like loops, conditions, and object-oriented programming.

#2about 2 minutes

Understanding essential game development terminology

Key concepts like sprites, the event loop, collision detection, ticks for timing, and PyGame's inverted Y-axis coordinate system are explained.

#3about 5 minutes

Building the foundational game window and loop

The initial setup involves importing PyGame, defining screen dimensions, setting frames per second (FPS), and creating the main game loop to display a blank window.

#4about 5 minutes

Creating the player sprite and handling keyboard input

A player is created as a Sprite class, added to a sprite group, and updated based on keyboard events to allow left and right movement.

#5about 4 minutes

Adding bullets and a shooting cooldown mechanic

A Bullet class is created and a shoot method is added to the player, which includes a cooldown timer to prevent continuous firing.

#6about 5 minutes

Spawning enemies and implementing collision detection

Enemies are created as a Sprite class with random horizontal positions, spawned using a custom event, and collision detection is implemented to destroy both the bullet and enemy on impact.

#7about 2 minutes

Replacing placeholder blocks with custom image assets

The basic colored squares for the player and enemies are replaced by loading, scaling, and displaying PNG image files for a more polished look.

#8about 1 minute

Finding resources and code for your own projects

The session concludes with links to additional resources, including the slides and the complete source code for the game in a Git repository.

Related jobs
Jobs that call for the skills explored in this talk.
Picnic Technologies B.V.

Picnic Technologies B.V.
Amsterdam, Netherlands

Intermediate
Senior
Python
Structured Query Language (SQL)
+1

Featured Partners

Related Articles

View all articles
A
Apify
What Developers Are Building to Win $1 Million with Apify
Apify started as a web scraping product, but quickly evolved into a full-blown platform and marketplace for developers to write code, and monetise it by creating Actors, tools that simplify the scraping process for others. Running until the end of J...
What Developers Are Building to Win $1 Million with Apify

From learning to earning

Jobs that call for the skills explored in this talk.