Pygame
Curriculum
Pygame · Game Dev

Pygame Tutorial

A complete Pygame path from beginner to pro - windows, game loops, sprites, animation, platformers, polish, packaging, and real game projects.

65 lessonsBeginner → ProGame Dev
Start from the beginning

Curriculum

Work through each section in order. Every lesson ends with practice and key points so the idea sticks.

Beginner

Getting Started

5 lessons · ~53 min
  1. 1
    What is Pygame?

    Learn what Pygame is, what it can build, and how it fits into Python game development.

  2. 2
    Install Python and Pygame

    Install Python 3, set up a virtual environment, and install Pygame or pygame-ce.

  3. 3
    Your First Pygame Window

    Create a window with pygame.init and display.set_mode, then quit cleanly.

  4. 4
    The Game Loop

    Understand the process-update-draw cycle that keeps a game alive every frame.

  5. 5
    Surfaces and Colors

    Learn what a Surface is, how colors work, and how the screen Surface relates to drawing.

Beginner

Drawing & Display

4 lessons · ~43 min
  1. 6
    Drawing Shapes

    Draw rectangles, circles, lines, and polygons with pygame.draw.

  2. 7
    flip() vs update()

    Learn how display.flip and display.update show your drawings on screen.

  3. 8
    Rectangles and pygame.Rect

    Use pygame.Rect for position, size, movement, and handy edge properties.

  4. 9
    Clock and Frame Rate

    Control how fast your game runs with pygame.time.Clock and tick.

Beginner

Input

4 lessons · ~44 min
  1. 10
    Events and Quitting

    Handle the event queue, detect QUIT, and close your game cleanly.

  2. 11
    Keyboard Input

    Read keydown events and use key constants like K_LEFT and K_SPACE.

  3. 12
    Mouse Input

    Track mouse position and respond to clicks with mouse events and mouse.get_pos.

  4. 13
    Holding Keys vs Keydown

    Compare KEYDOWN events with pygame.key.get_pressed for smooth held movement.

Beginner

Sprites & Media

6 lessons · ~66 min
  1. 14
    Images and blit

    Load an image Surface and draw it with blit at a position.

  2. 15
    load, convert, convert_alpha

    Speed up blits and preserve transparency with convert and convert_alpha.

  3. 16
    Fonts and Text

    Render score and labels with pygame.font and blit the text Surface.

  4. 17
    Sound and Music Basics

    Play short sound effects and background music with mixer.Sound and music.

  5. 18
    Collision with Rect

    Detect overlaps with colliderect and respond when two rectangles touch.

  6. 19
    Keep Objects On Screen

    Clamp positions so players and objects cannot leave the window bounds.

Beginner

First Game

6 lessons · ~73 min
  1. 20
    Move a Player Rectangle

    Build a controllable player with held keys, speed, and screen clamping.

  2. 21
    Falling Objects

    Spawn objects that fall downward and reset when they leave the screen.

  3. 22
    Score and Lives

    Track score and lives, update them on catch or miss, and draw them with a font.

  4. 23
    Organize With Functions

    Split a growing game into functions for setup, input, update, and draw.

  5. 24
    Mini Project: Catch Game

    Build a complete catch game with player, falling items, score, lives, and game over.

  6. 25
    Beginner Review and Next Steps

    Review beginner Pygame skills and choose practical next projects to grow.

Intermediate

Sprites & Groups

5 lessons · ~59 min
  1. 26
    The Sprite Class

    Subclass pygame.sprite.Sprite to give game objects an image, a rect, and a clean update method.

  2. 27
    Sprite Groups

    Organize sprites into Group and GroupSingle containers so you can update and draw many objects at once.

  3. 28
    update and draw Groups

    Drive the game loop with group.update() and group.draw(screen), including custom draw order when needed.

  4. 29
    Custom Events and Timers

    Schedule recurring actions with pygame.USEREVENT, set_timer, and custom event types for spawning and cooldowns.

  5. 30
    Removing Sprites with kill()

    Remove sprites from all groups safely with kill(), and clean up bullets, enemies, and pickups when they leave play.

Intermediate

Animation & World

6 lessons · ~80 min
  1. 31
    Frame Animation

    Cycle through a list of surfaces over time to animate idle, run, and jump frames on a sprite.

  2. 32
    Sprite Sheets

    Load a sprite sheet image and slice it into frames with subsurface rectangles for compact animation assets.

  3. 33
    Scrolling Backgrounds

    Create endless or parallax scrolling backgrounds by wrapping blit positions as the camera or player moves.

  4. 34
    Camera Follow

    Track the player with a camera offset so large levels can scroll while sprites stay in world coordinates.

  5. 35
    Tile Maps Intro

    Represent levels as grids of tile IDs, convert them into rects or sprites, and draw a tile-based world.

  6. 36
    Loading Levels From Data

    Load level layouts from JSON or text files so you can edit maps without changing game code.

Intermediate

Platformer Skills

6 lessons · ~79 min
  1. 37
    Gravity and Platforms

    Apply gravity with vertical velocity and resolve landing on solid platform rects for a basic platformer body.

  2. 38
    Jumping and Grounded State

    Implement jumps that only start when grounded, with coyote time and jump buffering as optional feel upgrades.

  3. 39
    Better Collision Responses

    Improve platformer collisions with one-way platforms, head bumps, and safer ordering against multiple tiles.

  4. 40
    Simple Enemy Patrol

    Build enemies that walk back and forth between points or edges, flipping direction on walls and ledges.

  5. 41
    Health and Damage

    Track hit points, apply damage with invulnerability frames, and react when health reaches zero.

  6. 42
    HUD and UI Overlays

    Draw health, score, and messages in screen space above the world so the HUD stays fixed while the camera moves.

Intermediate

Game Flow

6 lessons · ~78 min
  1. 43
    Menus and Game States

    Structure the app as menu, play, and other states so input and drawing stay organized as the project grows.

  2. 44
    Pause and Game Over

    Add pause overlays and game-over handling that freeze gameplay while still drawing the world underneath.

  3. 45
    Constants and Config

    Centralize screen size, speeds, colors, and paths in a config module so tuning does not require hunting through files.

  4. 46
    Gamepad Basics

    Read joysticks and controllers with pygame.joystick for movement axes and button presses alongside the keyboard.

  5. 47
    Intermediate Project: Platformer

    Combine sprites, camera, tiles, gravity, enemies, health, and game states into a small playable platformer.

  6. 48
    Intermediate Review

    Review sprites, animation, cameras, tile maps, platformer physics, combat, HUD, and game flow before advanced topics.

Advanced

Architecture

5 lessons · ~77 min
  1. 49
    Object-Oriented Game Architecture

    Structure a Pygame project with clear classes for the game loop, entities, and systems so features stay easy to extend.

  2. 50
    Scene Manager Pattern

    Switch between menu, play, pause, and game-over screens cleanly with a scene stack and lifecycle hooks.

  3. 51
    Resource Manager

    Cache images, sounds, and fonts so assets load once, fail clearly, and stay easy to reload during development.

  4. 52
    Lightweight Entity Components

    Compose game objects from small data and behavior pieces without adopting a full ECS framework.

  5. 53
    Data-Driven Design

    Move tuning values, spawn tables, and level layouts into data files so design changes do not require rewriting code.

Advanced

Polish & Performance

5 lessons · ~74 min
  1. 54
    Particle Systems

    Add juice with lightweight particle bursts for explosions, thrusters, dust, and pickups.

  2. 55
    Scaled Pixel Art Display

    Render to a low-resolution internal surface and scale it up for crisp pixel art on modern displays.

  3. 56
    Performance Tips

    Keep frame rates stable with smarter blits, fewer allocations, group collision choices, and careful surface use.

  4. 57
    Profiling Your Game

    Find real bottlenecks with timing probes, cProfile, and simple on-screen frame metrics.

  5. 58
    Packaging and Distributing

    Bundle a Pygame project into a shareable build with PyInstaller, clean assets, and a short run checklist.

Advanced

Capstones & Next

7 lessons · ~102 min
  1. 59
    Capstone: Space Shooter

    Build a complete vertical space shooter with scenes, spawning, collisions, score, and particle juice.

  2. 60
    Capstone: Endless Runner

    Create a side-scrolling endless runner with scrolling ground, obstacle spawning, jump feel, and rising difficulty.

  3. 61
    Capstone: Puzzle Game

    Implement a grid puzzle with board state, input selection, match rules, and cascade clears.

  4. 62
    Saving Progress

    Persist settings, unlocks, and high scores with JSON save files and safe load defaults.

  5. 63
    Polish Checklist

    Use a practical checklist for feel, feedback, clarity, accessibility basics, and release readiness.

  6. 64
    Pygame vs Pygame-ce

    Understand the relationship between Pygame and Pygame-ce, what to install, and how to keep projects compatible.

  7. 65
    Next Steps in Game Dev

    Plan what to learn after Pygame: stronger design habits, tools, engines, and a portfolio project path.