Your First Game Window
The very first step into game-making: meet pygame, pop open a real game window, paint it, and drop a shape on it — no need to understand every line yet, just make something appear.
Code Your Own Games — build real arcade games in the browser with pygame, no install.
The very first step into game-making: meet pygame, pop open a real game window, paint it, and drop a shape on it — no need to understand every line yet, just make something appear.
The setup lines from your first window, finally explained: meet the game loop — the heartbeat that redraws the screen 60 times a second and powers every video game.
Learn the screen's secret map — where (0,0) lives, how colors are made of three numbers, and how to paint robots and houses out of rectangles, circles, and lines.
Turn frozen shapes into living animation — nudge a position a tiny bit every frame, give it speed, and make a ball bounce off the walls like a real arcade game.
Grab the controls — catch arrow-key presses with KEYDOWN events, steer a player around the screen, and keep it from wandering off the edge.
Give your shapes invisible boxes called Rects, then use colliderect to catch the exact moment the player touches a target — and make the target jump to a brand-new random spot.
Add a score that climbs every time you catch the target, and learn to draw real words and numbers on the screen with pygame fonts — gluing text together the safe way, with str() and .format().
Your first complete game — a basket you slide left and right to catch stars falling from the sky, with a score, three lives, and a real Game Over screen, built from everything you've learned.
Upgrade the star catcher from one falling star to a whole swarm of them, using a Python list to spawn, move, and clean up many game objects at once.
Turn a never-ending toy into a real game with a start screen, a game-over screen, a restart, and difficulty that ramps up — all driven by one little state variable.
Your second full game — pilot a ship through a falling asteroid field, dodge with the arrows, survive as long as you can, and watch the difficulty ramp up.
The grand finale — a complete Space Shooter you can run, then a menu of ideas for making it your own and sharing it with the world.