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
CH
Chris Heilmann
All the videos of Halfstack London 2024!
Last month was Halfstack London, a conference about the web, JavaScript and half a dozen other things. We were there to deliver a talk, but also to record all the sessions and we're happy to share them with you. It took a bit as we had to wait for th...
All the videos of Halfstack London 2024!

From learning to earning

Jobs that call for the skills explored in this talk.