CodeRigor

COURSE / REAL PRACTICE

Your first Python game loop

Build a playable catch-the-ball game: pure state updates, input, elapsed time, Pygame shapes, scoring and restart.

Lessons & exercises7 authored lessons3 units
Start with the first lesson.

Read the explanation and diagrams, then work through the practice. Your browser profile supplies your saved progress.

What you’ll work toward

Play a complete desktop catch-the-ball game, test its model without a display, and explain the event → update → render loop. The optional desktop renderer uses pygame-ce; hosted exercises use the Python standard library.

Read an explanation, inspect the diagrams and work through the available checks, debugging exercises and builds. Feedback and prerequisite links guide the next step.

Before you start

This course builds on these skills:

Individual lessons can add prerequisites. Your lesson progress shows your actual readiness.

A look inside the first lesson

Keep game state independent from pixels

Python
width, paddle_width, radius = 480, 90, 9
half = paddle_width / 2
print("center", width / 2)
print("paddle bounds", half, width - half)
print("ball center bounds", radius, width - radius)

Your lesson sequence

Follow the same units and lessons in either view. Prerequisite links and your practice progress stay with each lesson.