Editor

Pygame challenges

Pygame Online · 10 challenges in 3 games

Each challenge hands you a broken game and one function to write; fix them all and the whole game is your code.

Bounce

Make a ball bounce, keep a paddle on screen and aim your shots, then play the Pong you built.

  1. 1. Bounce off the wallsThe balls fly off the screen and never come back.10 XP
  2. 2. Keep the paddle on screenHold an arrow key and the paddle slides off the screen.15 XP
  3. 3. Aim with the paddleEvery hit sends the ball back flat, so the computer always reaches it.20 XP

Snake

Move the head, detect crashes, eat and grow, and stop U-turns: four functions make Snake.

  1. 1. Move the snakeThe snake is frozen: its head never moves.15 XP
  2. 2. Crash detectionThe snake goes through walls and through itself without a scratch.20 XP
  3. 3. Eat and growThe snake swims over the food and stays the same length.25 XP
  4. 4. No U-turnsPress the arrow pointing back and the snake bites itself at once.20 XP

Blocks

Turn pieces, check that they fit and clear full rows to build a falling-blocks puzzle.

  1. 1. Turn a piecePress Up and the piece stays exactly as it was.20 XP
  2. 2. Does it fit?Pieces fall through the floor and through each other.25 XP
  3. 3. Clear full rowsFull rows stay on the board and the stack only grows.30 XP

New to pygame? The pygame fundamentals cover the game loop, drawing, keys and collisions first. Progress is kept in this browser.