๐Ÿ Python ๐Ÿ–ฑ๏ธ No install to start ๐Ÿ“ฆ Export a runnable project Ages 10+

Python Studio

Pick one of the games from the series, tune it, and play it right here in the browser. Then download a real Pygame project with proper main.py code and run it on any computer with Python.

Companion to the My First Python Game series. Nothing to install here, it works on a school computer.

๐ŸฆŠ
Lumo says: go at your own pace. Pick a game, press Play, then change one number and watch what happens. When it feels right, download the project and open the same code in Python.
Make your own art and sounds: draw sprites in Pixel Studio and make music or sound effects in Sound Studio, then bring them into your game.

Tune your game

These values change how the game plays here and in the exported Python. Move one at a time to feel the difference.

Place it in the world

Drag the player token where you want to start, or use Left and Right arrows then Enter to drop. The start spot saves and appears in your Python as STARTX.

Player starts in the middle. Drag it and press Play.

Play your game

On a keyboard use arrows or WASD to move, and Space or Z for the action button. Nothing happening? Go back to Tune and change a value, then press reset.

Download your Python project

This is a real Pygame project. Download the zip, then run it with Python on any computer.

Code it live

This is the real main.py. Change a number, press Apply, and the game updates here and in the download.

How to run your project

  1. Install Python 3 from python.org (free).
  2. In a terminal, install Pygame: pip install pygame.
  3. Unzip the download and run python main.py.
  4. To change the game, edit main.py and run it again. That is the same code you tuned here.
๐ŸฆŠ
Lumo says: every Pygame game is the same four steps repeating forever. Once you know the loop, you can read almost any game.

The Pygame game loop

  1. Get the events. Check what the player did (closed the window, pressed a key, clicked).
  2. Update the world. Move the player, the ball, the enemies, and check for collisions.
  3. Draw the screen. Fill the background, then draw everything in its new place.
  4. Flip and wait. pygame.display.flip() shows the frame, and clock.tick(60) keeps it at 60 frames a second.

The loop runs in a while True: block, so it repeats until the player quits. Every game on the series uses this exact shape.

Keep learning

Open the Pygame cheatsheet for the drawing and event calls, or read the series for a step by step build of each game.